php ImageMagick生成缩略图

<?php
function resize($die="A01"){
$path="/opt/htdocs/pic/www/epaper/".date("Ymd")."/".$die;
$image_handle =new Imagick($path."/page_pic.jpg");
$width=$image_handle->getImageWidth();
$height=$image_handle->getImageHeight();
$percent=179/$width;
$height=ceil($height*$percent);
$image_handle->thumbnailImage(179,$height);
$image_handle->writeImage($path."/page_pics.jpg");
}
$page_no=addslashes($_GET["die"]);
$c=$_GET["c"];
$day=date("Ymd");
$_file_dir ="/opt/htdocs/pic/www/epaper/$day/$page_no";
$path="$_file_dir/page_pic.jpg";
$paths="$_file_dir/page_pics.jpg";
if(!file_exists($paths)){
resize($page_no);
}
echo file_get_contents($paths);
?>

此文来自易心博客(http://exblog.ex123.net)
详文请参考:http://exblog.ex123.net/html/php_imagemagick.html

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注