I performed a complete cache clean and discovered that this obliterates everything under /media/
(as noted by me below and later correctly observed by an answer, it is indeed just the cache that is being wiped under the /media/
folder). Unfortunately there are some email distributions from the past that rely on these images and I am curious as to whether there is a way to regenerate all of the thumbnails / cache entries under the /media/
folder?
So, for example, in this situation I am seeing missing files such as:
[Mon Apr 15 11:46:01 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/T/E/TE0213.jpg
[Mon Apr 15 11:46:01 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/F/X/FX0413_1.jpg
[Mon Apr 15 11:46:01 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/F/B/FB0413.jpg
[Mon Apr 15 11:46:01 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/F/K/FK0413.jpg
[Mon Apr 15 11:46:02 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/E/V/EV0413.jpg
[Mon Apr 15 11:46:02 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/F/P/FP0413.jpg
[Mon Apr 15 11:46:02 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/F/E/FEA0413.jpg
[Mon Apr 15 11:46:03 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/F/Z/FZ0413.jpg
[Mon Apr 15 11:46:03 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/G/B/GB0413.jpg
[Mon Apr 15 11:46:03 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/F/S/FS0413.jpg
[Mon Apr 15 11:46:04 2013] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/0/image/265x/4df79eab33525d08d6e5fb8d27136e95/F/U/FU0413.jpg
When I do look for the images, for example, I do see the originals present in:
media/catalog/product/F/U/
The goal, therefore, is to regenerate all of these appropriately.
Moving further along in this, I can see that I need to be able to execute a Magento script upon failure of finding an image (particularly since many of these images are not being found due to being called by external references such as emails or other sites). I expect to use something like this from Apache to call this script that I'm hoping to get help on here:
# Inside of .htaccess: ###################### # if the file exists, just send it RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^cache/.*$ - [L] # if it doesn't exists, rewrite to PHP script RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^cache/.*$ /path/to/script.php?url=$0 [L]
Best Answer
It cleared the image cache.
Your original images are still in place, so the clear image cache function obviously did not do as you first said,
obliterates everything under /media/
Your major problem then is that your templates are not doing proper media helper calls to regenerate the image. Where exactly are you having your missing image problem?
A typical helper call asks for the url, if no URL exists, the image is added to the cache on the fly with the size chosen and then the URL is returned to the html block.
$this->helper('catalog/image')->init($_product, 'small_image')->resize(135)
Product View Page image
Product Listing
Note that the init function for the helper takes the following inputs:
and processes $imageFile with the following:
POC code that feeds out resized image url when queried with image string. For Store 1 in this sample, yours according to the given URLs is Store 0.
Feed it a get query:
Which kicks out: