File does not exist: /home/username/public_html/domain.tld/media/catalog/product/cache/
It cleared the image cache.
media/catalog/product/F/U/
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
<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />
Product Listing
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
Note that the init function for the helper takes the following inputs:
public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile=null)
and processes $imageFile with the following:
if ($imageFile) {
$this->setImageFile($imageFile);
} else {
// add for work original size
$this->_getModel()->setBaseFile($this->getProduct()->getData($this->_getModel()->getDestinationSubdir()));
}
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.
<?php
/*
* imgurl.php allows you to return image url for imgquery.
* http://www.example.com/imgurl.php?imgurl=/l/p/lp_5009.jpg
*/
ini_set('memory_limit','256M');
require_once 'app/Mage.php';
umask(0);
Mage::app()->setCurrentStore('1');
$userModel = Mage::getModel('admin/user');
$userModel->setUserId(0);
$product = "0";
$imgurl = "";
if (isset($_GET["imgquery"])) {
$string = filter_input(INPUT_GET, 'imgquery', FILTER_SANITIZE_URL);
$imgquery = trim($string);
$imgurl = Mage::helper('catalog/image')->init($product, 'image', $imgquery)->resize(250, 250);
}
if ($imgurl) {
echo '<img src="' . $imgurl . '"/>';
}
?>
Feed it a get query:
http://www.example.com/imgurl.php?imgquery=/l/p/lp_5009.jpg
Which kicks out:
<img src="http://www.example.com/media/catalog/product/cache/1/image/250x250/9df78eab33525d08d6e5fb8d27136e95/l/p/lp_5009.jpg"/>
There's likely a small issue with the file path somewhere in there. I know that you said you echo'd it out, but you may be missing something like perhaps a leading slash that shouldn't be there, etc.
One little thing I like to do to be 100% sure when inspecting this kind of thing, is to copy the file path, open up terminal, go to the Magento root, then ls <pasted_value>
- that way you know for sure if the path is right or not.
The error message that you're seeing is originating in:
Mage_Catalog_Model_Product_Attribute_Backend_Media::addImage()
{
...
if (!$file || !file_exists($file)) {
Mage::throwException(Mage::helper('catalog')->__('Image does not exist.'));
}
Best Answer
Magento has a very neat feature for that. When adding a product, go to the custom options tab (it's usually the last one) and select "add new option". From the "input type" drop-down, select "file" and you should be good to go!