In the storage_core_bridge_storage_generate() styled images are being generated with a source based on the getUri() output of the storage object's parent. This works fine initially but some modules and image effects expects a source image path that be used to identify the original image.

Since the only available data in the function is the storage object and its parent, and I couldn't find any methods for getting the drupal URI from a storage object, the URI is looked up from the DB based on the ID of the storage object.

Also, the StorageTempURI class has been modified to support temp URIs that holds a reference back to the original URI. As long as the StorageTempURI is treated as an object, the getOriginalURI() method can be called. But the path of the temp file is also adjusted to match the original URI, so even if the StorageTempURI object is converted into a string (the temporary:// URI), that string can be converted back to the original URI by using StorageTempURI::decodeTempURI($temp_uri).

Comments

esbenvb’s picture

This is the patch containing the changes.

Remember to do the right attributions when porting patches, as mentioned on http://drupal.org/user/989064

esbenvb’s picture

This patch is an example of where this can be useful.
http://drupal.org/node/1943166

jbrown’s picture

Thanks for this - I'll take a closer look at it.

esbenvb’s picture

I've removed some of the fancy stuff with temp paths matching original URL as it was not used anyway and i suspect that it is causing trouble...

thijsvdanker’s picture

I've tested it and it works great, thanks esbenv!
I can't say I've reviewed it.. my knowledge of storage api is too limited to know if it's the most suitable solution :)

dwatts3624’s picture

Issue summary: View changes

I've tested this (re. the manualcrop application) and everything works great!

josh.fabean’s picture

I tested this as of today (May 13 2015) and patch in comment #4 works great on latest dev build. Any reason why this isn't patched on the module yet this would save people time and frustration.

perignon’s picture

Hasn't been on the radar since I took over as a co-maintainer. I been working backwards trying to see if there is any traction on old issues.

perignon’s picture

Hrm.. patch has to be re-rolled.

perignon’s picture

Yikes... I attempted a branching re-roll to 7.x-1.6 and it wasn't pretty. I had to trash it. This may require a manual re-coding type of re-roll.

queenvictoria’s picture

I've rerolled this against -dev trying to fix another issue. It didn't fix my issue but it should apply cleanly and didn't break anything (more than it was already anyway).

perignon’s picture

@queenvictoria. Thanks for the work. I will work on getting it applied toward the end of the week. Out on vacation at the moment.

  • Perignon committed 4a8fdeb on 7.x-1.x authored by esbenvb
    Issue #1943124 by esbenvb, queenvictoria: StorageTempURIs should support...
perignon’s picture

Committed. Needs a little testing out of the dev branch then we can mark this as fixed.

jonhattan’s picture

getOriginalURI() method seems unneccesary. It is not used anywhere.

perignon’s picture

I'll check that out. Removing unused code is always welcomed with this elephant of a module.