Forums

WP Retina 2x
[resolved] Doesn't work with CDN / W3 Total Cache (3 posts)

  1. jaapstronks
    Member
    Posted 4 months ago #

    It appears the plugin doesn't work when using a CDN for serving images. I'm using W3 Total Cache and your plugin (client side), and when I activate CDN (I use Maxcdn), the part of the plugin that swaps the requested low-res file with a retina file doesn't work.

    An example page on my website:
    http://www.jaapstronks.nl/rotterdam-vernieuwt-lokale-democratie-met-crowdsourcing-is-het-wat/

    Here's the thing: when using CDN, the image http://www.example.com/.../file.png is replaced by cdn.example.com/.../file.png. (The cdn subdomain is redirected to Maxcdn by use of a CNAME record, it's technically not a local file). When using a retina machine, this file should be replaced by cdn.example.com/.../file@2x.png, but it isn't.

    The kicker is: when accessed directly, this cdn.example.com/.../file@2x.png exists and is accessible - the retina-sized images are still generated and are mirrored on the cdn server and everything - the only problem is that the 'file swapping process' as I'll call it doesn't work.

    You can test it on the website URL I posted above: the page serves images from the 'cdn' subdomain that do not redirect to their retina counterparts; if you manually change the 'cdn' to 'www' in the image url's, they are in fact redirected to the retina versions.

    Is this a problem with either WP Retina 2x or W3 Total Cache, does the problem reside on my end, is it something I can configure? Thanks!

    http://wordpress.org/extend/plugins/wp-retina-2x/

  2. Jordy Meow
    Member
    Plugin Author

    Posted 4 months ago #

    I'm glad you did some debugging as I heard of this issue before, but not using a CDN myself I couldn't really test anything.

    First, it's an excellent news to hear that the @2x files are mirrored on the CDN. I was actually really worried about that.

    The "file swapping process" is made by a script called retina.js. WP Retina 2x uses this plugin for the client method. And it seems I found the issue: https://github.com/imulus/retinajs/issues/40

    Basically the script and the images are loaded from different domain... and for security reason, the browser wouldn't allow the script to query anything from a different domain. I have no idea how we could resolve that issue right now, and maybe you could add a message to that forum there.

    You can also try the very last version of the retina.js (replace the plugin's one with the latest one) but I doubt the issue is resolved at the moment...

  3. mikeheller
    Member
    Posted 1 month ago #

    I'm testing this as well, demo page here: http://photokaz.com/2013/04/testing-wp-retina-2x-plugin/

    W3 Total Cache allows you to specify your hostnames but it looks like the first one is limited to CSS only so I'm not sure if you remove them all it will still serve images from the CDN.

Reply

You must log in to post.

About this Plugin

About this Topic