You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Saturday, April 21st 2012, 11:14am

Create plugin ONLY if image exists?!

Hi there,

I want to auto-create a bunch of plugins, but ONLY if the image really exists. Any idea how this could be done? I thought about checking if the URL is Null, but that´s not working. Even if the path to the image is incorrect or the image does´nt exist, the plugin will be created. It should be something like this:

<action name="exist">
if(plugin[xyz].url == Null, removeplugin(xyz));
</action>

But as I said, the url is ALWAYS set, even if the image does not exist. So how to check if the image exist and if not, the plugin never gets created?

Thanks and best regards
Nupsi

Zephyr

Professional

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

2

Saturday, April 21st 2012, 3:05pm

Hmm can't you check server side if the image exist?

Alsoo plugin[...].loaded is set to true once its loaded. I reckon an invalid image would not be loaded. but I would make sure the plugin is not loading at that time

Source code

1
2
3
4
5
if(plugin[%1].loading == false, 
    if(plugin[%1].loaded == false,
              removeplugin(%1);
    );
);
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

3

Saturday, April 21st 2012, 4:08pm

RE: Create plugin ONLY if image exists?!

You can use the loaded attribute to do this.

Hi there,

I want to auto-create a bunch of plugins, but ONLY if the image really exists. Any idea how this could be done? I thought about checking if the URL is Null, but that´s not working. Even if the path to the image is incorrect or the image does´nt exist, the plugin will be created. It should be something like this:

<action name="exist">
if(plugin[xyz].url == Null, removeplugin(xyz));
</action>

But as I said, the url is ALWAYS set, even if the image does not exist. So how to check if the image exist and if not, the plugin never gets created?

Thanks and best regards
Nupsi
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

4

Saturday, April 21st 2012, 6:52pm

Works like a charm! Thanks a million *attention*
Your posts made me think if the "onloaded"-attribute inside the plugin itself is´nt the same as the loaded-attribute and it seems like it is. So if I put the following action in the plugins onloaded-tag, it becomes only active if the plugin really was fully loaded. If the image don´t exist, the plugin wont get loaded completly and the onloaded-tag is irgnored, which is excactly what I was looking for.

Thx again and best regards
Nupsi

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

5

Saturday, April 21st 2012, 8:01pm

Correct.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

karlo

Beginner

Posts: 4

Location: Latvia

Occupation: Photographer

  • Send private message

6

Thursday, July 3rd 2014, 9:12pm

Hmm can't you check server side if the image exist?

Alsoo plugin[...].loaded is set to true once its loaded. I reckon an invalid image would not be loaded. but I would make sure the plugin is not loading at that time

Source code

1
2
3
4
5
if(plugin[%1].loading == false, 
    if(plugin[%1].loaded == false,
              removeplugin(%1);
    );
);
Hi, it seems, that this check doesn't work with dynamically added plugins *sad*