dongluolie3487
2014-06-23 06:46 阅读 169
已采纳

imagecopymerge()已经在服务器中的两个图像(水印使用)

I have two photos already in server, trying to use one for WATERMARK..

I am using the below script:

<?php

$watermark  = "../images/watermark/watermark.gif";
$image  = "../images/mainphoto.gif";


$padding        = 0; 
$opacity        = 100;  


$watermark_size     = getimagesize($watermark);
$watermark_width    = $watermark_size[0];  
$watermark_height   = $watermark_size[1];  

$image_size     = getimagesize($image);  
$dest_x         = $image_size[0] - $watermark_width - $padding;  
$dest_y         = $image_size[1] - $watermark_height - $padding;

if(!$image  || !$watermark) die("Error: main image or watermark could not be loaded!");


imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width,        $watermark_height, $opacity);

?>

I am getting the following error:

Warning: imagecopymerge() expects parameter 1 to be resource, string given in /home/neatbuz/public_html/asite_service/inc_watermark.php on line 26

please help..

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dtxox60220 dtxox60220 2014-06-23 13:44
    $image = imagecreatefromgif ( "../images/mainphoto.gif" );
    $watermark = imagecreatefromgif ( "../images/watermark/watermark.gif" );
    

    i'd recommend to use png instead of gif images

    点赞 评论 复制链接分享

相关推荐