I've created a magento product with no default (Admin) images, but I've properly setted an image as thumbnail, small_image and imageset for the "italian" store view.
If I use the following code in a phtml files I'get the correct image url:
echo "url = " . Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(95,95)
I get : media/catalog/product/cache/6/image/80x/9df78eab33525d08d6e5fb8d27136e95/1/9/1901186_10152274267007184_1589016979_n_7.jpg
Inside a controller for an ajax callback fucntion I use the following:
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
echo "url = " . Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(95,95);
but I alwais get the placeholder image /media/catalog/product/cache/6/thumbnail/95x95/9df78eab33525d08d6e5fb8d27136e95/placeholder/websites/3/LOGO_1.png
I try to set the product storeId before loading the product data but no result:
$product = Mage::getModel('catalog/product');
$product = $product->setStoreId(6);
$product = $product->loadByAttribute('sku',$sku);
echo "vediamo " . Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(95,95);;
Thank for any helps and sorry for my english. Giuseppe