file_entity_file_formatter_file_image_view() checks whether an image's stream wrapper is STREAM_WRAPPER_LOCAL before rendering a file with an image style. However, if you have an image stored with a writable but non-local stream wrapper, image_style_create_derivative() is happy to create the derivative--it creates a temporary local version, then moves if to the remote location.
file_entity_file_formatter_file_image_view() should just check whether the image's stream wrapper is readable, not whether it's local. Patch coming in a moment.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | file_entity-1358860-remote_files-7.patch | 1.04 KB | firebird |
| #1 | 1358860-1-file_entity-display_remote_derivatives.patch | 866 bytes | becw |
Comments
Comment #1
becw commentedHere's a patch.
Comment #2
smartinm commentedThe patch works on file_entity-7.x-1.x from media module too.
Comment #3
dave reidAssigning for review.
Comment #4
coderintherye commentedThis works. I'm sad how long I spent trying to figure this out myself before finally tracking it down to the file_entity module.
I'm going to go ahead and mark as RTBC, though yes there is a huge performance hit. To me the hit is worth it, but perhaps you'll think differently Dave, and if so, I guess we should brainstorm how we can have remote files included without being too much hit on performance.
Comment #5
dave reidComment #6
dave reidThis doesn't apply at all with the current code and will need a larger re-roll.
Comment #7
firebird commentedHere's a similar fix we did to fix the same problem. Applies to the current dev version.
Comment #8
agentrickardLooks good. Is this testable?
Comment #9
kimwes commentedHad problem with latest dev version of media+file_entity and storage_api. I have set so that storage_api saves images to s3. File entity didn't render images, only showed icons. With patch from #7 the image showed correctly from s3.
Comment #10
ParisLiakos commentedpatch was no longer applying, so rerolled and commited
http://drupalcode.org/project/file_entity.git/commit/86580fe
Comment #12
dave reidRe-opening. Based on the original issue description, I expected this to use SREAM_WRAPPERS_WRITE not STREAM_WRAPPERS_READ. Because if the stream wrapper is not writeable, it cannot have image style derivatives?
Comment #13
dave reidI guess changing to writeable would break using remote_stream_wrapper images. Will need to think about this.