您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php如何实现修改图片大小

2025/9/16 8:02:43发布35次查看
在php中可以通过【$filename=./qr/$id.jpg;$percent=0.4;list($width, $height) = getimagesize(...);】方法实现修改图片大小,其中参数percent为缩小比例。
推荐:《php视频教程》
php修改图片大小的实现方法
$filename = "./qr/$id.jpg";$percent = 0.4;list($width, $height) = getimagesize($filename);$new_width = $width * $percent;$new_height = $height * $percent;$image_p = imagecreatetruecolor($new_width, $new_height);$image = imagecreatefromjpeg($filename);imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);imagejpeg($image_p,'./images/thumb/'.$id.'.jpg');
filename为文件名;
percent为缩小比例;
imagejpeg为输出保存图片。
以上就是php如何实现修改图片大小的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product