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

  • 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

    Code
    if(plugin[%1].loading == false, 
        if(plugin[%1].loaded == false,
                  removeplugin(%1);
        );
    );
  • 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

  • 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

  • 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

    Code
    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*

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!