您好,欢迎访问一九零五行业门户网

php生成缩略图的功能

客户自己上传的图片大小不标准,想让传上来的图片统一变成150x113尺寸的。从网上搜到的程序在ie里用正常,到了别的浏览器(如搜狗浏览器等)就不行,这是什么原因?(感觉老是不执行)
代码如下:
$maxwidth) || ($maxheight && $height > $maxheight)){ 
if($maxwidth && $width > $maxwidth){ 
$widthratio = $maxwidth/$width; 
$resizewidth=true; 

if($maxheight && $height > $maxheight){ 
$heightratio = $maxheight/$height; 
$resizeheight=true; 

if($resizewidth && $resizeheight){ 
if($widthratio  $ratio = $widthratio; 
}else{ 
$ratio = $heightratio; 

}elseif($resizewidth){ 
$ratio = $widthratio; 
}elseif($resizeheight){ 
$ratio = $heightratio; 

$newwidth = $width * $ratio; 
$newheight = $height * $ratio; 
if(function_exists(imagecopyresampled)){ 
$newim = imagecreatetruecolor($newwidth, $newheight); 
imagecopyresampled($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); 
}else{ 
$newim = imagecreate($newwidth, $newheight); 
imagecopyresized($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); 

imagejpeg ($newim,$name . .jpg); 
imagedestroy ($newim); 
}else{ 
imagejpeg ($im,$name . .jpg); 

}
if(isset($_files['image']['size'])){ 
if($_files['image']['type'] == image/pjpeg){ 
$im = imagecreatefromjpeg($_files['image']['tmp_name']); 
}elseif($_files['image']['type'] == image/x-png){ 
$im = imagecreatefrompng($_files['image']['tmp_name']); 
}elseif($_files['image']['type'] == image/gif){ 
$im = imagecreatefromgif($_files['image']['tmp_name']); 
}
if($im){ 
if(file_exists($filename.jpg)){ 
unlink($filename.jpg); 
}
resizeimage($im,$resizewidth,$resizeheight,$filename);  //生成小图
imagedestroy ($im);
echo 上传成功,图片文件名是:;
echo $myname..jpg;

}
//****************************************
}else{
echo ;
}
?>
回复讨论(解决方案) 你看看 product/min/ 目录下是否有生成的图片
ie ,firefox,chrome试试看,这三个行的话说明代码没问题。
其它类似信息

推荐信息