Imagick 无法载入中文文件名
Imagick 无法载入中文文件名
<?php<br /><br /><br />$filepath = 'F:\';<br />$filename="哈.tif";<br /><br />$encoded_filename = urlencode($filename);<br />$encoded_filename = str_replace("+", "%20", $encoded_filename);<br /><br />//$filename = iconv('utf-8', 'gb2312', $filename);<br />$jpgfilename = substr($filename,0,strrpos($filename,'.')).'.jpg';<br />$im = new Imagick($filepath.$filename);<br />$im->thumbnailImage(1200, 0);<br /><br />$width = $im->getImageWidth() ;<br />$height = $im->getImageHeight();<br />$width800 = 1200;<br />$height800 = 1200*$height/$width;<br />$canvas = new Imagick();<br />$canvas->newImage($width, $height, '');<br />$canvas->setImageFormat("jpeg");<br />$canvas->compositeImage($im, imagick::COMPOSITE_OVER, 20, 10);<br />$canvas->writeImage($filepath.$jpgfilename);<br />?>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号