php动态处理图片后输出显示
程序员文章站
2022-03-21 20:00:49
...
php动态改变图片尺寸后输出,输出图片时使用下面的地址:
image_resize.php?img=image.jpg&w=150&h=150&constrain=1
w和h为要显示的尺寸
0) { // calculate resized height and width if percent is defined $percent = $percent * 0.01; $w = $sw * $percent; $h = $sh * $percent; } else { if (isset ($w) AND !isset ($h)) { // autocompute height if only width is set $h = (100 / ($sw / $w)) * .01; $h = @round ($sh * $h); } elseif (isset ($h) AND !isset ($w)) { // autocompute width if only height is set $w = (100 / ($sh / $h)) * .01; $w = @round ($sw * $w); } elseif (isset ($h) AND isset ($w) AND isset ($constrain)) { // get the smaller resulting image dimension if both height // and width are set and $constrain is also set $hx = (100 / ($sw / $w)) * .01; $hx = @round ($sh * $hx); $wx = (100 / ($sh / $h)) * .01; $wx = @round ($sw * $wx); if ($hx
上一篇: PHP判断网络文件是否存在
下一篇: java生成html万年历