Closed (fixed)
Project:
AmazonS3
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Reporter:
Created:
13 Apr 2015 at 12:57 UTC
Updated:
3 Oct 2018 at 02:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
deviantintegral commentedComment #2
deviantintegral commentedComment #3
deviantintegral commentedHere's a patch that re-implements image style support, without relying on the private file system. A few problems I ran into:
So how does this work?
s3://image style URL ingetImageStyleUrl()viaamazons3_image_style_path_alter(). This ensures we have the proper bucket in the URL, which the default implementation doesn't get us.StreamWrapper->getExternalUrl(). If it detects an image style, and that image style doesn't exist on S3, it will return a URL that points to our style callback atamazons3/image-derivative/.... Otherwise, it returns a URL to S3 directly skipping the rest of this.amazons3_image_deliver(), we first check if the derivative already exists. If it does, we 301 redirect to it.Comment #4
deviantintegral commentedAlso: This totally requires this core patch to image.module: https://www.drupal.org/node/1358896#comment-9297197
Comment #5
ericduran commentedThis is great Andrew. I'll give it a better pass tomorrow. That being said from the description this sounds awesome. Especially serving the initial one from tmp.
Comment #6
deviantintegral commentedAn update that adds:
Comment #7
ericduran commentedDoes it need full path here? Can't tell from the snippet.
I only had one small note. Everything else look great. I'm ok with merging as is.
Comment #8
deviantintegral commentedThanks!
That callback isn't a full path, but something like amazons3/image-derivative. It's a constant so I can reference it when generating image URLs.
Comment #9
deviantintegral commentedComment #11
ericduran commented@deviantintegral yea, I noticed it was a constant. I meant Full PHP path so `\Drupal\amazons3\StreamWrapper::stylesCallback` instead of `StreamWrapper::stylesCallback` assuming we were already using `use \Drupal\amazons3\StreamWrapper`
Comment #12
deviantintegral commentedOh, that! The module doesn't declare a namespace because I've seen that break things without requiring xautoload. So it's either use statements or full paths, and that class is only used once at the moment.
Comment #14
tim520 commented@deviantintegral Thanks for this great patch. But I still have some images can not be generated styles in Amazon S3, most of them are succeed.
Comment #15
jadsay commented@deviantegral: the image derivates are not being generated and uploaded to my s3 bucket only the original image is being uploaded.
I applied all the patches mentioned in the module documentation but still every image rendered with image styles is not working.
Comment #16
jadsay commentedComment #17
al.ex commented+1 confirmed that image derivate generation isn't working properly yet. I've actually resorted to trigger it manually upon changes using custom code in order to make this work somehow.
Another issue I'm facing here is that under certain circumstances, derivates aren't getting uploaded to S3. The problem is that I can't reproduce these circumstances, it seems to occur randomly. The logs don't tell anything either. Could this be related to the shutdown function implementation?
Comment #18
kristen polSince the last activity was 3 years ago, marking this back as fixed. If you are having trouble with this feature, please create a new issue and add steps to reproduce.