PHP图片缩放函数

by 尘缘 on 九月 26th, 2008 // Filed Under → study-notes

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图片缩放函数”,但请保留本文出处和版权信息。
作者:尘缘,QQ:130775,来源:http://www.4wei.cn/archives/217



走过路过,千万不要飞过,那是鸟人: