This is my PHP water-marking function:
function img_watermark($image) {
$stamp = imagecreatefrompng('images/wm.png');
$im = imagecreatefromjpeg($image);
$marge_right = 10;
$marge_bottom = 10;
$sx = imagesx($stamp);
$sy = imagesy($stamp);
// Copy the stamp image onto our photo using the margin offsets and the photo
// width to calculate positioning of the stamp.
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
// Output and free memory
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
}
And this is my HTML code:
<img src="<?php img_watermark('images/ornek.jpeg');?>" />
But it just gives me something like this:
.......<,� u��/,R����M�����7����a4�3eY&k� �Tƃ#Ki��'�S�^� A��2_^�����L*���\�LMSOݺ7���"@���\k*)�4I����5�<�C�LP��/W�2w� qopwnnnw3e��҂g�����QB\�_ȋc��#� F$��`4;;���[T�b�-��XגsΩ(�J����"G���;�O=it�*��˗>���Nw��o�#¨�8����J����wz�V�W���>�{���#�����z�^����/?��7VWo?�������CRVS3ӷ�������?������ڝ�}��Ϳ���������O=q��~�?���IY� ?MvN�Y�����k�7[�hwg�������<��/��O���s7o�u���?����3F 8�|�~ᗟ}��v'����#g���6�/|���~ᫍ(����?p(�B����_?�sY���G>|�ŗ�V)%�\Z��� J���7/...........
I want it to show me watermarked image. How can I fix this?