Php生成缩略图
来源:互联网 发布:list数据排序 编辑:程序博客网 时间:2024/06/05 13:22
<?phpheader("Content-type: image/jpeg");//原图文件$file = "images/flower_1.jpg";// 缩略图比例$percent = 0.5;// 缩略图尺寸list($width, $height) = getimagesize($file);$newwidth = $width * $percent;$newheight = $height * $percent;// 加载图像$src_im = @imagecreatefromjpeg($file);$dst_im = imagecreatetruecolor($newwidth, $newheight);// 调整大小imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);//输出缩小后的图像imagejpeg($dst_im);imagedestroy($dst_im);imagedestroy($src_im);?>
来自:http://www.5idev.com/p-php_imagecopy_imagecopyresized.shtml#imagecopy
bool imagecopyresized ( resource dst_image, resource src_image, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h )
将一幅图像中的一块正方形区域拷贝到另一个图像中。dst_image 和src_image 分别是目标图像和源图像的标识符。如果源和目标的宽度和高度不同,则会进行相应的图像收缩和拉伸。坐标指的是左上角。本函数可用来在同一幅图内部拷贝(如果dst_image 和src_image 相同的话)区域,但如果区域交迭的话则结果不可预知。
bool imagecopy ( resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h )
将 src_im 图像中坐标从src_x,src_y开始,宽度为 src_w,高度为src_h 的一部分拷贝到dst_im 图像中坐标为dst_x 和dst_y 的位置上。
- php生成缩略图
- PHP生成图片缩略图
- PHP生成图片缩略图
- PHP批量生成缩略图
- PHP批量生成缩略图
- PHP批量生成缩略图
- PHP图片生成缩略图
- PHP生成图片缩略图
- php 生成缩略图
- PHP 生成缩略图类
- PHP 生成图片缩略图
- php生成缩略图类
- 生成缩略图PHP
- PHP生成图片缩略图
- Php生成缩略图
- php生成缩略图
- PHP缩略图的生成
- PHP 生成图片缩略图
- python实现电影文件名批量更新
- android的AsyncTask类
- 计算机视觉方面的公司-转载
- C#中DateTime类用法大全
- 对象的序列化
- Php生成缩略图
- Inject EJB to Struts 2 Action and Custom Validators
- 网络游戏服务器架构2
- 全新整理:微软、谷歌、百度等公司经典面试100题[第101-160题]
- 相同语句,时间段不一样,不同执行计划分析心得
- BackTrack5 PIN码破解无线路由器
- Java大文件上传
- ubuntu tomcat6 设置JAVA_HOME
- 用JavaScript(js)对时间格式化