It doesn't appear that light box URL's are being rewritten although the imagecache preset for the lightbox image is being uploaded to S3 properly.

Comments

hozt’s picture

I was able to reproduce the issue when using lightbox2. I did not track down the exact problem, but most likely we will have to create another theme override that changes the url of the href when lightbox2 is enabled.

dmurray’s picture

Ok great, For mine and probably a lot of sites I think think the imagecache preset that people use with the lightbox2 image probably has the largest file size and would benefit the most from being able to be served through CloudFront.

dmurray’s picture

I don't know a whole lot of PHP but to do this would it require editing this part of the module and adding an if statement to recognize when the class of the url is set to lightbox-processed?

function cloudview_theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = null) {
  if (is_null($attributes)) {
    $attributes['class'] = 'imagecache imagecache-'. $namespace;
  } 
  $attributes = drupal_attributes($attributes);

  if ($cloudfront_url = cloudfront_create_url($namespace, $path)) {
    return '<img src="'. $cloudfront_url .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
  }
  
  return theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = null);
}
hozt’s picture

I believe we will need to override this before it gets to imagecache possibly by using theme_preprocess_content_field.

The file will also be served locally if you link to the file without using imagecache. I will poke around further this week and hope to have a solution soon.

If anyone has any other thought on this or a patch, send it in!

dmurray’s picture

Thanks for your help it's greatly appreciated!

dmurray’s picture

will this be fixed in the next release?

dmurray’s picture

This is an example, I cant seem to get it to serve from cloudfront.

hozt’s picture

Can you confirm if the image is lightbox image is getting uploaded to amazon?

dmurray’s picture

Yes I can confirm that it is being uploaded, it just not being rewritten on the page to point to the. Amazon image.

krisrobinson’s picture

subscribing