经测试代码如下:
<?php
/**
* GD2 library,生成缩略图
*
* @param
* @arrange (编程之家) jb51.cc
**/
function make_thumb($src,$dest,$desired_width)
{
/* read the source image */
$source_image = imagecreatefromjpeg($src);
$width = imagesx($source_image);
$height = imagesy($source_image);
/* find the desired height of this thumbnail,relative to the desired width */
$desired_height = floor($height*($desired_width/$width));
/* create a new,virtual image */
$virtual_image = imagecreatetruecolor($desired_width,$desired_height);
/* copy source image at a resized size */
imagecopyresized($virtual_image,$source_image,$desired_width,$desired_height,$width,$height);
/* create the physical thumbnail image to its destination */
imagejpeg($virtual_image,83);
}
/*** 来自:编程之家 jb51.cc(jb51.cc) ***/
?>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。