PHP图片缩放函数

[php]
function imgageshow($link,$alt="",$x="",$y="",$class=”)
{
$size = GetImageSize($link);
$width = $size[0];
$height = $size[1];
if($x!="" or $y!="")
{
if($width>$x){
$temp=$x/$width;
$width=$x;
$height=$height*$temp;
if($height>$y){
$temp=$y/$height;
$height=$y;
$width=$width*$temp;
}
}elseif ($height>$y){
$temp=$y/$height;
$height=$y;
$width=$width*$temp;
if($width>$x){
$temp=$x/$width;
$width=$x;
$height=$height*$temp;
}
}
else{
$width=$width;
$height=$height;
}
}else{
$width=$width;
$height=$height;
}
//echo "<img src="$link" alt="$alt" width="$width" height="$height" /><img src="\" border="0" alt="\&quot;$alt\&quot;" width="\&quot;$width\&quot;" height="\&quot;$height\&quot;" /><img src="\" border="0" alt="\&quot;$alt\&quot;" width="\&quot;$width\&quot;" height="\&quot;$height\&quot;" />

[/php]

发表评论