having this code:

$this->helper('catalog/image')->init($_product, 'slider_img')->resize(400,300)

how to check if the 'slider_img' exists?

1 Answer 1


was easy:

if ($_product->getSliderImg())


Found a better way to avoid any image exception using try/catch:

try {
  $product_img = $this->helper('catalog/image')->init($_product, 'header_slider_img')
catch (Exception $e) {
  Mage::log('Image '.$e->getMessage(), null, 'image_exception.log');
  • 1
    I can't, I've to wait 2 days
    – apedic
    Dec 2, 2014 at 0:22
  • if ($_product->getSliderImg() != 'no_selection') would be more proper for first solution, as image never returns false from what I know.
    – gnysek
    Mar 30, 2021 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.