Copy code The code is as follows:
//Original image
$dst = "/upload/20120914/20120914040740- 0.jpg"; //Note that the image path must be correct
//Get the original image information
$dst_info = getimagesize($dst);
switch ($dst_info[2])
{
case 1:
$dst_im =imagecreatefromgif($dst);break;
case 2:
case 3:
$dst_im = imagecreatefrompng($dst);break;
case 6:
$dst_im =imagecreatefromwbmp($dst);break;
default:
die("Unsupported file type 1");exit;
$src_info[2])
case 3:
$src_im =imagecreatefrompng($src);break;
case 6:
$src_im =imagecreatefromwbmp($src);break;
default:
die( "Unsupported file type 1");exit;
dst_im,$src_im,$dst_info[0]-$src_info[0]-10,$dst_info[1]-$src_info[1]-10,0,0,$src_info[0],$src_info[1],$ alpha);
//How to support the transparency of png itself
imagecopy($dst_im,$src_im,$dst_info[0]-$src_info[0]-10,$dst_info[1]-$src_info [1]-10,0,0,$src_info[0],$src_info[1]);
//Save the picture
switch ($dst_info[2]){
case 1 :
imagegif($dst_im,$dst);break;
case 2:
imagejpeg($dst_im,$dst);break;
case 3:
imagepng($dst_im,$ dst);break;
case 6:
imagewbmp($dst_im,$dst);break;
default:
die("Unsupported file type 2");exit;
}
imagedestroy($dst_im);
imagedestroy($src_im);
http://www.bkjia.com/PHPjc/326350.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/326350.html
TechArticleCopy code The code is as follows: //Original image $dst = "/upload/20120914/20120914040740-0.jpg" ; //Pay attention to the correct image path //Get the original image information $dst_info = getimagesize($dst); s...