Easy FancyBox
[resolved] https in image path? (7 posts)

  1. rvturnage
    Posted 4 years ago #

    I'm running easy fancybox on a Windows IIS server using WP 3.3.2. While trouble shooting some slow page load issues with IE 8 using webpagetest.org, I saw where it appears that fancybox is trying to load a lot of images using https...which my clients server is not set up to use, so i'm getting a lot of 404 errors. Here's what it's loading:


    Any thoughts on why it would be trying to load via https?


  2. RavanH
    Plugin Author

    Posted 4 years ago #

    There is no reason why these images should be loading over https. If you have a link for me so I can take a look, I might be able to spot the issue. If not, please follow the URL of the stylesheet that is generated by the plugin. It should be visible in the page source code and be of the format http:// ...your site domain/wp path... /wp-content/plugins/easy-fancybox/easy-fancybox.css.php?ver=1.3.4

    Open that stylesheet directly in your browser and tell me if you see any https there.

  3. rvturnage
    Posted 4 years ago #

    Hi, Ravan. Yes, https is indeed in the image path within the CSS file. It appears in the entries dealing with the AlphaImageLoader, both .fancybox-ie6 and .fancybox-ie classes.

    Thanks for your help.

  4. rvturnage
    Posted 4 years ago #

    One thing that just occured to me... client is also running W3 Total Chache plugin. Would css minification possibly be behind this?

  5. RavanH
    Plugin Author

    Posted 4 years ago #

    I've seen minification break the packed javascript that comes with FancyBox but never something like this, in css.

    I suspect it is the routine inside easy-fancybox.css.php that transforms the relative paths to the files needed by IE (AlphaImageLoader) into full URLs. It normally should detect the correct protocol (http or https) and prepend it to these paths in the stylsheet but apparently on Windows/IIS it does not do that correctly.

    It's a bug that you have caught :) (or at least a design flaw, not taking Windows into account) so I'll have to fix that. For the time being, you could do this:

    1. Open the plugin file easy-fancybox.css.php for editing (either withing the WP plugin editor or edit a local copy in a simple text editor)
    2. Find line 23 that looks like this

    $url = ( ( isset($_SERVER['HTTPS']) ) ? "https://" : "http://" ) . htmlspecialchars( $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']), ENT_QUOTES);

    3. Change the part ( ( isset($_SERVER['HTTPS']) ) ? "https://" : "http://" ) into "http://"

    This should fix the https issue but I wonder how these other server parameters like $_SERVER['HTTP_HOST'] and $_SERVER['SCRIPT_NAME'] are behaving on IIS. Could you tell me if the URLs (after applying the above steps) in the stylesheet are the correct full paths to the IE shadow images?

  6. RavanH
    Plugin Author

    Posted 4 years ago #

    UPDATE: replace step 3 with

    3. Change the part

    ( ( isset($_SERVER['HTTPS']) ) ? "https://" : "http://" )


    ( (empty($_SERVER['HTTPS']) || ($_SERVER['HTTPS'] == "off")) ? "http://" : "https://" )
  7. rvturnage
    Posted 4 years ago #

    Hi, Ravan. Those code updates worked perfectly! Thank you so much for your help, and for a really great plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic