Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If your getTarget is not reentrant and there is no for it to be then the calling chain is this:
- Image field formatter
- theme_image_style
- image_style_url
- image_style_path
- file_uri_target
- getTarget
- Output of getTarget gets into the image/generate URL
- image_style_generate
- image_style_path but with the URI already got back from getTarget. This is the feedback loop of death.
Comment | File | Size | Author |
---|---|---|---|
#25 | 858528-targeted.patch | 3.1 KB | Damien Tournoud |
#24 | 858528-targeted.patch | 3.1 KB | Damien Tournoud |
#20 | 858528-targeted.patch | 3.13 KB | Damien Tournoud |
#13 | targeted.patch | 2.79 KB | chx |
#12 | targeted.patch | 2.77 KB | chx |
Comments
Comment #1
chx CreditAttribution: chx commentedSo when i have converted the file system to a flexible one, well, THIS one wanted the original file_uri_target...
Comment #2
chx CreditAttribution: chx commentedHere is a more understandable example of what happens. If you have something like flickr://chx/4781325384/ which would serve the picture at http://www.flickr.com/photos/chx/4781325384/ then image style generate would create a URL like image/generate/large/flickr/www.flickr.com/photos/chx/4781325384/ instead of image/generate/large/flickr/chx/4781325384. And the flickr stream wrapper would get flickr://www.flickr.com/photos/chx/4781325384 and it would not know what the heck is on.
Comment #3
chx CreditAttribution: chx commentedHm, sorry, this does not break core.
Comment #4
chx CreditAttribution: chx commentedBut we have a shiny new major priority. Good!
Comment #5
drewish CreditAttribution: drewish commentedsubscribe
Comment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedI am *very* confused as of what file_uri_target() is actually supposed to do (transform an URI... into what?)...
Comment #7
Damien Tournoud CreditAttribution: Damien Tournoud commentedSo it seems that file_uri_target() is actually just designed to return the part of the URI after the '://' (while keeping it URL-encoded). As a consequence, the current implementation looks correct.
But file_uri_target() feels completely foobar right now. I guess we need something like this.
Comment #9
chx CreditAttribution: chx commentedDamien, this is a gem. In an issue about something being unclear you said:
:D
Your patch would revert what I did with file_uri_target. You can be right. Returning a locally writeable file path indeed more belongs to the local class than the generic interface. However we can not remove getTarget from there because if you want to extend that (nee hash_target) you simply can't.
Comment #10
andypostI think flickr is not a good example because this kind of field should have own formatter and does not correlate with image field at all
Comment #11
aaron CreditAttribution: aaron commentedsubscribe. and don't forget that image != imagefield, and with stream wrappers there's no technical reason that image couldn't work on remote images.
Comment #12
chx CreditAttribution: chx commentedIt seems drewish, Damien and I are all agreed on this patch.
Comment #13
chx CreditAttribution: chx commentedeh i moved too much. there is already a getTarget in local.
Comment #14
drewish CreditAttribution: drewish commentedThis seems like the sanest way out of the mess we've made.
Comment #15
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis looks very good to me. It's probably not the only modification we need to make to the stream wrappers, but it's a good first step.
Comment #17
aaron CreditAttribution: aaron commentedi was going to test out an example or two, but remembered that, unfortunately, the stream wrapper implementation is still a bit broken, as we can't file_copy from an external stream, because file_exists returns FALSE for streams (which is called against the source uri in file_unmanaged_copy). thus, we have to use a raw copy() as in http://drupalcode.org/viewvc/drupal/contributions/modules/media/media.mo....
thus, i have no real way of knowing if this approach is sound or not, as the only place where it's going to even matter is for local file systems. boo.
Comment #18
aaron CreditAttribution: aaron commentedsetting status back.
Comment #19
rfaysubscribe
Comment #20
Damien Tournoud CreditAttribution: Damien Tournoud commentedComment #21
chx CreditAttribution: chx commentedGiven drewish's comment I think we are good to go. (Damien's patch does not change the approach, i ran an interdiff, it just fixes a braino.)
Comment #22
Dries CreditAttribution: Dries commentedI believe pwolanin wrote a lot of this code so I'd like him to give it a thumbs up.
Comment #23
pwolanin CreditAttribution: pwolanin commentedLooks like this is reverting basically back to what we had earlier, so it seems fine to me.
One comment - why use substr() when elsewhere we do this:
We should be consistent, so CNW to make this code match more like:
Comment #24
Damien Tournoud CreditAttribution: Damien Tournoud commentedRerolled, your honor.
Comment #25
Damien Tournoud CreditAttribution: Damien Tournoud commentedMatching the logic.
Comment #26
pwolanin CreditAttribution: pwolanin commented[edit] new patch fixes the problem
Comment #27
pwolanin CreditAttribution: pwolanin commentedThe logic in question is returning FALSE on failure, as the function did before.
This looks ok to me now.
Comment #28
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.