【发布时间】:2012-09-21 12:24:20
【问题描述】:
这是我的 PHP 水印功能:
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);
}
这是我的 HTML 代码:
<img src="<?php img_watermark('images/ornek.jpeg');?>" />
但它只是给了我这样的东西:
.......���Nw��o�#¨�8����J����wz�V�W����>�{��� #������z�^����/?��7VWo?��������CRVS3ӷ������行��?�������}��Ϳ�� ��������O=q��~�?���IY� ?MvN�Y�����k�7[�hwg���������6�/|���~ᫍ(�� ��?p(�B����_?�sY���G>|�ŗ���V)%�\Z��� J���7/....... .
我希望它显示带水印的图像。我该如何解决这个问题?
【问题讨论】: