all. I'm trying to add custom watermark to product image with next code:

    ->init($_product, 'small_image')

but it still displays a product small image resized without any modification. Any ideas?

  • So I guess the build in watermark in System > Configuration > General: Design - Product Image Watermarks won't work for you? Anyway. Could you be more specific on where you add this code? Dec 4, 2014 at 14:52
  • yes, default watermark feature doesn't fit my needs. I have manufacturers logos, and i want to add watermark to products images. I insert this code to src of an image in products list. Like this: <img height="174" width="174" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(174)->watermark($imagefile); ?> alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
    – Styopchik
    Dec 4, 2014 at 15:20

1 Answer 1


finnaly, i figured out, how to put custom watermark to product image:

public function getWatermarkedImage(Mage_Catalog_Model_Product $product){

    if ($product->getImage() && $product->getImage() != 'no_selection'){
        $basePath = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath();
        $image = Mage::getModel('catalog/product_image');

        if(!file_exists($basePath . '/'. $product->getImage())) {
            return Mage::getBaseUrl('media') . '/catalog/product/placeholder/default/no-image.png';
        //$processor = new Varien_Image($image->getBaseFile());

        if (!file_exists($image->getNewFile())){

            $stamp = Mage::getModel('amshopby/value')->load($product->getManufacturer(),'option_id')->getImgMedium();
            $logoStamp = 'logo.png';
            if (!file_exists($basePath . '/watermark/default/' . $stamp)){
                if(!file_exists($basePath . '/watermark/default/')){
                    mkdir($basePath . '/watermark/default/', 0744, true);
                copy(Mage::getBaseDir('media') . '/amshopby/' . $stamp, $basePath . '/watermark/default/' . $stamp);

                if (file_exists($basePath . '/watermark/default/' . $logoStamp)){
                    $image->setWatermark($logoStamp, 'top-left', null, 170, 93, 100);
                $image->setWatermark($stamp, 'bottom-right', null, 200, 129, 100);
            catch (Exception $e) {
                return false;
        return $image->getUrl();

    else return Mage::getBaseUrl('media') . '/catalog/product/placeholder/default/no-image.png';


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.