Magento – Product Image Cache – Image Resizing

cacheimage

My question is about how and when images get created inside the product image cache. Specifically, if this code is executed:

$imageTag ='<br><img src="'.Mage::helper('catalog/image')->init($product ,
                'small_image')->resize(75).'" border="0" />';

And the following directory exists with 777 permissions:

/media/catalog/product/cache/1/small_image/

But there is no 75x/ subdirectory, will that directory get created and the resized image stored at the correct place? Or does that directory need to be available (through some other process) before attempting to get the URL for the resized image using the Magento helper?

Best Answer

Read this answer, https://magento.stackexchange.com/a/1008/361

The number within the URL doesn't represent the scale or pixel dimensions of the image - it is the store view.

All directories/files are automatically created the moment the front-end is viewed and the resize code is executed. It is that simple.