• Resolved hulsman1986

    (@hulsman1986)


    Hello! I am have been fiddling with your plugin, it is awesome. However, when trying to use the wp retina 2x plugin within a multisite; trouble starts to appear. Hopefully there is someone who has encountered the following issue and has found a solution.

    First of; client side isnt an option as it doesn’t allow my images to be responsive. So i tried the server side option, but without succes. Tried to update the retinaimages.php, added the rewrite rule, but no luck. So i finally chose the html rewrite.

    Html rewrite works! BUT only when debug mode is enabled. The same goes for the client side option. It works, but only in debug mode.

    This is happening on local, on a staging server ánd on our live server. So i don’t think its a Cloudflare thing. Does anyone recognize this issue?

    https://www.ads-software.com/extend/plugins/wp-retina-2x/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter hulsman1986

    (@hulsman1986)

    I opted for the client side solution (for now) and moderated the retina.js in order to keep the images at 100% width and auto height.

    $('#main-games img').each(function(){
            new RetinaImage(this);
    });

    Only issue that remains is that @2x is added to the image url when using this snippet, even though @2x is already added… So you get the correct images but also a load of 404’s in the console ??

    Plugin Author Jordy Meow

    (@tigroumeow)

    Html rewrite works! BUT only when debug mode is enabled

    Are you using caching? Maybe a cache plugin?

    Cloudflare thing

    I don’t know on your local, but with Cloudflare the server-side wouldn’t work. The HTML Rewrite would though, and the Client-side too.

    Only issue that remains is that @2x is added to the image url when using this snippet, even though @2x is already added

    Why is @2x already there?
    You can check if the filename contains @2x, and if it doesn’t, then you’ll call the line “new RetinaImage”, otherwise not. Simple ??

    Thread Starter hulsman1986

    (@hulsman1986)

    Hi, thanks for replying! Still lovin’ you plugin and spreading the name towards my m8’s ??

    I am sticking with the client side solution. The site is cached three times through memcache, varnish and cloudflare… I bet one of those might cause the rewrite to go bad? ??

    Anyway, the issue with the double @2x was due to a lazy load script. it caused the retina.js plugin to be called again when loading new content ?? i sawk.

    My dirty solution was to add the following script when loading new content:

    //serve retina images. Works with the WP 2x retina plugin
    $('#main-games .article-header img').each(function(){
          var imageSource = $(this).attr('src');
          if (imageSource.indexOf("@2x") >= 0) {
                //already is a retina image
          } else {
                //its not a retina image
                 new RetinaImage(this);
          }
    });
    Plugin Author Jordy Meow

    (@tigroumeow)

    memcache, varnish and cloudflare

    Memcache => No HTML Rewrite, Cloudflare => No Server-Side. Only Client-Side left ^^

    the issue with the double @2x was due to a lazy load script

    Ah yes, that’s often the case, and that’s where the Server-Side works very well in fact.

    My dirty solution was to add the following script when loading new content

    Your solution is not dirty: it’s the right one ??

    Thread Starter hulsman1986

    (@hulsman1986)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Multisite html rewrite only works when debug is enabled’ is closed to new replies.