php教程|php手册
php,按,指定,大小,等比,缩放,生成,上传,图片,缩,略图,php,教程,按,指定,大小,等比,缩放,生成,上传,图
php教程-php手册
php教学按指定大小等比缩放生成上传图片缩略图
/**
* *
*等比缩放
* @param unknown_type $srcImage 源图片路径
* @param unknown_type $toFile目标图片路径
* @param unknown_type $maxWidth 最大宽
* @param unknown_type $maxHeight 最大高
* @param unknown_type $imgQuality 图片质量
* @return unknown
*/
php的简单系统源码下载,ubuntu系统 访客模式,高端爬虫图片大全,php代码数组从小到大排序,机电seo教程lzw
function resize($srcImage,$toFile,$maxWidth = 100,$maxHeight = 100,$imgQuality=100)
{
.net mysql 网站 源码,安装ubuntu提示cpu,tomcat是收费的吗,风力爬虫结构,php数据转换常量,东莞百度seo排名优化软件lzw
list($width, $height, $type, $attr) = getimagesize($srcImage);
if($width < $maxWidth || $height < $maxHeight) return ;
switch ($type) {
case 1: $img = imagecreatefromgif($srcImage); break;
case 2: $img = imagecreatefromjpeg($srcImage); break;
case 3: $img = imagecreatefrompng($srcImage); break;
}
$scale = min($maxWidth/$width, $maxHeight/$height); //求出绽放比例
cpa诱导网站源码,utc取消ubuntu,关于tomcat服务器,java 模拟爬虫,php网站用什么服务器,seo专业术语是什么意思lzw
if($scale < 1) {
$newWidth = floor($scale*$width);
$newHeight = floor($scale*$height);
$newImg = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($newImg, $img, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
$newName = “”;
$toFile = preg_replace(“/(.jpg|.jpg|.jpeg|.jpg)/i”,””,$toFile);
switch($type) {
case 1: if(imagegif($newImg, “$toFile$newName.jpg”, $imgQuality))
return “$newName.jpg”; break;
case 2: if(imagejpeg($newImg, “$toFile$newName.jpg”, $imgQuality))
return “$newName.jpg”; break;
case 3: if(imagepng($newImg, “$toFile$newName.jpg”, $imgQuality))
return “$newName.jpg”; break;
default: if(imagejpeg($newImg, “$toFile$newName.jpg”, $imgQuality))
return “$newName.jpg”; break;
}
imagedestroy($newImg);
}
imagedestroy($img);
return false;
}