PHP照片放水印,十分简易的编码

PHP照片放水印,十分简易的编码   重要词:企业网站建设 网站建设 网站制作   访问量:1351 次 文本图片水印:
编码以下:
$w = 80;
$h = 20;
$im = imagecreatetruecolor($w,$h);
$textcolor = imagecolorallocate($im, 123, 12, 255);
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $grey); //画一矩形框并添充

// 把标识符串写在图象左上方
imagestring($im, 3, 2, 3, Hello world! , $textcolor);

// 輸出图象
header( Content-type: image/jpeg
imagejpeg($im);
imagedestroy($im);

照片图片水印

$groundImg = DSC05940.jpeg
$groundInfo = getimagesize($groundImg);
$ground_w = $groundInfo[0];
//print_r($groundInfo);
$ground_h = $groundInfo[1];
switch($groundInfo[2]){
case 1:
$ground_im = imagecreatefromgif($groundImg);
break;
case 2:
$ground_im = imagecreatefromjpeg($groundImg);
break;
case 3:
$ground_im = imagecreatefrompng($groundImg);
break;
}

$waterImg = DSC05949.jpeg
$imgInfo =getimagesize($waterImg);
$water_w = $imgInfo[0];
$water_w = $imgInfo[1];

switch($imgInfo[2]){
case 1:
$water_im = imagecreatefromgif($waterImg);
break;
case 2:
$water_im = imagecreatefromjpeg($waterImg);
break;
case 3:
$water_im = imagecreatefrompng($waterImg);
break;
}
imagecopy($ground_im,$water_im,100,100,0,0,500,500);
header( Content-type: image/jpeg

imagejpeg($ground_im);
合拼照片php出示了许多涵数:比如:imagecopymerge,imagecopyresized

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://fkjzgwx.cn/jingyan/3881.html