This module used to work just fine with image styles then I upgraded to D7.2 and now they don't seem to work right. My thumbnail url is being generated as http://folioh.s3.amazonaws.com/styles/thumbnail/s3/images/1/187987-happy...

It seems the styles aren't being generated at all.

Comments

pichot’s picture

+1 Having the same problem.

allella’s picture

This also occurred for me after updating to Drupal 7.2.

The project page for Media Amazon says,

Image styles are delivered first through the private file system, which generates a derivative on S3 and is served from S3 thereafter.

but it looks like it's no longer generating the derivative on the first call to the image style.

Manually calling http://example.com/system/files/styles/style_name/s3/images/imagename.jpg will generate the image style.

The node templates use

render($content['field_someimage']);

However, the render() function in the node templates now return the S3 path, like http://bucketname.s3.amazonaws.com/styles/style_name/s3/images/imagename..., even though it has never been generated the image style by first calling http://example.com/system/files/styles/style_name/s3/images/imagename.jpg

While debugging, the media_amazon_url_outbound_alter() function in the media_amazon.module fires/executes for many other path on the page, but it doesn't seem to fire when render() is called by the node template.

    // deliver the image through the private file system
    // also creates derivative on S3 at the same time
    $path = url('system/files/styles/' . $style_path_fragment);

I'm not sure if this is a bug, or if we should be using another theme function, or variable, with the properly altered Media Amazon's url_outbound_alter path. The theme_image_style() function mentions that it "does not work with images outside the files directory nor with remotely hosted images".

justafish’s picture

Assigned: Unassigned » justafish
infines’s picture

ETA on this patch?

justafish’s picture

orangecoat-ciallella is correct, something changed in core and hook_url_alter is no longer picking up the external URL generated by the stream wrapper. I have a fix that I've pushed into the new repo that you can try, but I haven't written up any docs for installing the new module yet. It requires the latest amazon sdk and you'll need to configure your security settings via the awssdk module: http://drupal.org/node/1171712/commits

infines’s picture

This seems to be working nicely, it even seems to fix the authenticated user upload problem [http://drupal.org/node/1199562]. It runs a bit slower, but I assume that functionality is coming fairly soon.

olrandir’s picture

Will there be a fix for this issue in this project as well (media_amazon for D7.2), or should we wait for a full release of the amazonS3 module? Is there a timeframe for that?

Also, is the media_amazon module being deprecated in favor of amazonS3?

I tested applying the changes from the commit in #5 to media_amazon's MediaAmazonS3StreamWrapper.inc, and on first glance this seems to fix the issue here as well. Will test some more and come back. Kudos for the work!

justafish’s picture

no I won't fix it here as well, this is fixed in amazons3 so use that instead:
http://drupal.org/node/1171712/release

justafish’s picture

Status: Active » Fixed
justafish’s picture

Project: Media: Amazon » AmazonS3
Version: 7.x-1.0-beta3 » 7.x-1.0-beta4
allella’s picture

As pointed out in #5 and #8, IF you're already using the Media Amazon module, you'll want to switch to the AmazonS3 module.

Steps:

  1. Disabled Media Amazon module
  2. Downloaded and installed AmazonS3 7.x-1.0-beta4 module
  3. Followed the sites/all/modules/AmazonS3/README
  4. Clear cache for good measure

Now image styles are now properly generating S3 paths.

Notes:

  • Amazon S3 module requires PHP 5.3
  • The capital first letter "A" is important for case-sensitive commands, like when using Drush download (dl).
  • I'm using Drupal 7.4 and everything is working. AmazonS3 may have trouble with Drupal 7.0 or 7.1, since some API functions changed in 7.2. Suggest upgrading to at least 7.3 (since 7.2 had security issues that have been patched).
drush dl AmazonS3

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.