Watermark Image Is Not Transparent

Hi all,

I use CImageHandler from https://github.com/tokolist/yii-components/blob/master/protected/extensions/yiicomp/components/ImageHandler/readme.md

I set watermark by doc :

Yii::app()->ih->load( $dst_filename )->watermark( $src_filename, 10, 10, CImageHandler::CORNER_RIGHT_BOTTOM, 0.1)->save( $dst_filename );

But as result I get image above, but not transparent watermark.

I thought that problem with watermark image and get image from here

But there is no watermark anyway…

Can it be that something is not installed in my system or what?

phpinfo shows :


GD Support 	enabled

GD Version 	bundled (2.0.34 compatible)

FreeType Support 	enabled

FreeType Linkage 	with freetype

FreeType Version 	2.4.3

GIF Read Support 	enabled

GIF Create Support 	enabled

JPEG Support 	enabled

libJPEG Version 	6b

PNG Support 	enabled

libPNG Version 	1.2.46

WBMP Support 	enabled

XBM Support 	enabled


Do you use watermark for your yii app? If yes which ?

I thought, that problem can be with image which I use as watermark and I found http://www.wpclipart.com/animals/H/horses/horse_2/horse_watermark.png image, which is supposed as watermark.

I get image above but not watermark.

I found old code (it worked under php4 - class.rwatermark.php) where watermark was set "on fly"

On this image we see fone under the horse.But I would like to set watermark while uploading image, not "on fly".

Can I be in error, but seems that problem was not in horse image ? If the image invalid, could you please give a link to some valid image, as for sample?


Install ImageMagick and use the image extension with the ImageMagick driver.

The extension does not support a watermark method, but ImageMagigck.

You can add a method ‘watermark’ to the Image_ImageMagick_Driver.php file/class:

public function watermark($prop)


        $watermark = $prop['watermark'];

        $position = $prop['position'];

        $cmd = escapeshellcmd($this->dir . 'composite' . $this->ext) . ' -gravity ' . $position . ' ' . $watermark . ' ' . $this->cmd_image . ' ' . $this->cmd_image;

        if ($error = exec($cmd))


            $this->errors[] = $error;

            return FALSE;


        return TRUE;