• Jordy,

    I still have an issue when using the AWS upload plugin by Brad. Brad’s plugin works well and hooks in with your @2x generated images and moves them to S3. However your plugin doesn’t re-write the URL for the S3 side. It appears we’d need to tell it what the CDN or sub domain is for our image, and then the javascipt could ping to see if the image exists and load it if it does – none of the re-write methods seem to fix the issue, it only works if the @2x images remain and are served from the default web server.

    https://wordpress.org/plugins/wp-retina-2x/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter djdeejay

    (@djdeejay)

    Even on debug mode its not loading the @2x images, despite them being there if I manually change the URL…

    Plugin Author Jordy Meow

    (@tigroumeow)

    Sorry, I am doing some house-keeping and all for the plugin but I don’t have much time to look into your issue. It would be a lot of debug and time for me since I don’t have the same configuration at all. Can you ask a friend or hire a developer to help you? I will definitely update the plugin if I have the solution a big closer to me.

    I am also using the Amazon S3 and CloudFront plugin to handle my images and would love support for this…

    It really is a great platform for speed on the cheap… Thanks for all your help and Support 🙂

    I had this problem and solved it by patching these lines in wp-retina-2x.php to make it reuse the original host name as modified by the S3 plugin instead of rewriting it to a local URL. I haven’t tested this with other setups and it may break things for you if your settings aren’t the same as mine (I don’t know why the original code looked the way it did)

    In wr2x_picture_rewrite, starting on line 143:

    $img_urlinfo = parse_url($node->getAttribute( "src" ));  //kalleboo
    $hostinfo = $img_urlinfo['scheme'].'://'.$img_urlinfo['host'].'/';  //kalleboo
    $img_pathinfo = wr2x_get_pathinfo_from_image_src( $node->getAttribute( "src" ) );
    $filepath = trailingslashit( ABSPATH ) . $img_pathinfo;
    $potential_retina = wr2x_get_retina( $filepath );
    
    if ( $potential_retina != null ) {
    	$retina_pathinfo = ltrim( str_replace( ABSPATH, "", $potential_retina ), '/' );
    	$retina_url = trailingslashit( $hostinfo ) . $retina_pathinfo;  //kalleboo
    	$img_url = trailingslashit( $hostinfo ) . $img_pathinfo;  //kalleboo
    	$from = $doc->saveXML($node);

    P.S. there’s another gotcha with the S3 plugin: If you turn on filename versioning in S3 settings then it breaks the retina plugin since it can’t find the versioned directories that exist on S3 locally. Might want to put that one in the troubleshooting docs.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘URL's not being re-written properly if on S3/subdomain’ is closed to new replies.