Is there any function that given a cache image product file return the original one ?
Ex.
cache URL : BASEURL/media/catalog/product/cache/2/image/9df78eab33525d08d6e5fb8d27136e95/a/l/IMAGE.jpg
result:
BASEURL/media/catalog/product/a/l/IMAGE.jpg
Is there any function that given a cache image product file return the original one ? Ex.
|
|||
|
This works
|
|||
|
The image URL that you've given is impossible to have with a Magento store. I'm guessing you wanted it to be obfuscated, but in doing so have made it impossible to answer. I can't think of any reasons to de-construct the image path unless you are web-scraping another website, otherwise, you would have direct access to the product model and could fetch this information directly. Nevertheless, using a real example. Eg
De constructing the cache image path
Locating the original imageIf uploaded via the Magento admin, the original image is located at, So getting the original URL is pretty easy, just remove the cache directory path and hash. Ie. Remove So
Becomes
If uploaded via dataflow/import, the original image is located in
But beyond there would be guesswork. However people want to format their upload DIR for import is really up to them and the subdirectory the images are in really isn't relevant - as they provide the relative path to the image when uploading. A bit about the md5 Hash
Optional args if there is a watermark
So for example, with the defaults
The This is the default Magento value for the hash
Attributions: sonassi.com |
|||||||||||
|
Short answer - no. There is no method to return the base image based on the cache image url. However, if you remove the cache folder and the hash you should be able to intuit what the URL would be, e.g.:
remove everything after product until the prefix trie (in this case, remove
Perhaps a better way of dealing with this, though, is to use the object model:
|
|||
|