php读取中文图片文件读不了,编码问题
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><?php
$image='小图.jpg';
$percent=0.05;
$im=getimagesize($image);
$width=$im[0];
$hight=$im[1];
switch ($im[2]) {
case 1:
$im=@imagecreatefromgif($image);
break;
case 2:
$im=@imagecreatefromjpeg($image);
break;
case 3:
$im=@imagecreatefrompng($image);
break;
}
$logo='1.jpg';
$im1=getimagesize($logo);
//print_r($im1);
switch ($im1[2]) {
case 1:
$im1=@imagecreatefromgif($logo);
break;
case 2:
$im1=@imagecreatefromjpeg($logo);
break;
case 3:
$im1=@imagecreatefrompng($logo);
break;
}
imagecopy($im, $im1, 700,-100,0,0,'440','771');
// 底下图 上面图
$te=imagecolorallocate($im,255,255,255);
imagettftext($im,12,0,20,20,$te,'../simhei.ttf','新年快乐');
$newwidth=$width*$percent;
$newheight=$hight*$percent;
$new=imagecreatetruecolor($newwidth,$newheight);
imagecopyresized($new,$im,0,0,0,0,$newwidth,$newheight,$width,$hight);
header("Content-type: image/jpeg");
imagejpeg($new);//编译图片
//if(imagejpeg($im,'new.jpg')){
// echo "水印成功";
//}
//imagejpeg($new,'小图.jpg');
//imagejpeg($im,'大图.jpg');
?>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号