imagick 无法载入中文文件名
imagick 无法载入中文文件名
thumbnailimage(1200, 0);
$width = $im->getimagewidth() ;
$height = $im->getimageheight();
$width800 = 1200;
$height800 = 1200*$height/$width;
$canvas = new imagick();
$canvas->newimage($width, $height, '');
$canvas->setimageformat(jpeg);
$canvas->compositeimage($im, imagick::composite_over, 20, 10);
$canvas->writeimage($filepath.$jpgfilename);
?>
$im = new imagick($filepath.$filename);
到这一步就会报错:
uncaught exception 'imagickexception' with message 'unable to open image `f:\哈.tif': no such file or directory @ error/blob.c/openblob/2638' in f:\workspace\test\1.php:12
stack trace:
#0 f:\workspace\test\1.php(12): imagick->__construct('f:\.tif')
#1 {main}
thrown
------解决方案--------------------
那大哥您就别用中文文件名成不
看这个情况应该是这个包只支持utf-8的文件名,你在linux下跑估计就没什么问题了
------解决方案--------------------
参考一下这个吧
http://s.yanghao.org/program/viewdetail.php?i=91439
------解决方案--------------------
关于中文或其他多字节文件名的问题(仅限windows)
这是php的死症――php不能读取windows里面的unicode文件名,但其他系统可以
因为其他系统的unicode文件名多为utf-8编码,windows是特殊的混合编码
但php可以读取符合本地系统codepage的文件名,例如简体windows读取汉字(常用,限gb2312/gbk以内,如果有unicode extent汉字因为超出936的codepage也不属此列)的文件名没有问题,但为何web的php不行,因为apache……再次无解
所以php处理多字节windows符合本地codepage文件名只能绝对路径方式,处理unicode文件名只能用取巧的方式(短路径)+com,其他函数基本无力