安装了apache php imagick,并且一切正常。 因为浏览器不能显示TIF图片,于是只有转为为GIF
使用imagick转化tif为gif时,大部分都能转化成功,就小部分显示时,页面直接显示无法打开该页面。
主要代码: $new_image=new Imagick();
$animation = new Imagick(); //建立一个对象。
$handle = file_get_contents($tifShow);
$animation->readImageBLOB($handle);
$sum=$animation->getNumberImages();
for($i=0;$i<$sum;$i++){
$animation->previousImage();
$new_image->addImage($animation->getImage());
$new_image->setImageFormat('gif');
$new_image->setImageDelay(150); } $animation->setFormat('gif');
header( 'Content-Type: image/gif' );
echo $animation->getImagesBLOB();
//asker:www.yuanshi88.comtif文件是对的,不存在图片错误
后来测试得知:在$animation->readImageBLOB($handle);出的问题。注释掉这句以后的代码,页面就不显示“无法打开该页面”。
难道Imagick做的不够完善?
使用imagick转化tif为gif时,大部分都能转化成功,就小部分显示时,页面直接显示无法打开该页面。
主要代码: $new_image=new Imagick();
$animation = new Imagick(); //建立一个对象。
$handle = file_get_contents($tifShow);
$animation->readImageBLOB($handle);
$sum=$animation->getNumberImages();
for($i=0;$i<$sum;$i++){
$animation->previousImage();
$new_image->addImage($animation->getImage());
$new_image->setImageFormat('gif');
$new_image->setImageDelay(150); } $animation->setFormat('gif');
header( 'Content-Type: image/gif' );
echo $animation->getImagesBLOB();
//asker:www.yuanshi88.comtif文件是对的,不存在图片错误
后来测试得知:在$animation->readImageBLOB($handle);出的问题。注释掉这句以后的代码,页面就不显示“无法打开该页面”。
难道Imagick做的不够完善?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货