PHP中imagecopyresampled()参数详解
2015-11-16 18:44
633 查看
imagecopyresampled()函数
bool imagecopyresampled ( resource dstimage,resourcedst_image , resource src_image , int dstx,intdst_x , int dst_y , int srcx,intsrc_x , int src_y , int dstw,intdst_w , int dst_h , int srcw,intsrc_w , int src_h )$dst_image:新建的图片
$src_image:需要载入的图片
$dst_x:设定需要载入的图片在新图中的x坐标
$dst_y:设定需要载入的图片在新图中的y坐标
$src_x:设定载入图片要载入的区域x坐标
$src_y:设定载入图片要载入的区域y坐标
$dst_w:设定载入的原图的宽度(在此设置缩放)
$dst_h:设定载入的原图的高度(在此设置缩放)
$src_w:原图要载入的宽度
$src_h:原图要载入的高度
For example:
$filename="20151126.jpg"; $percent=0.2; header("Content-type:image/jpeg"); list($width,$height)=getimagesize($filename); $newWidth=$width*$percent; $newHeight=$height*$percent; $thumb=imagecreatetruecolor($newWidth,$newHeight); $source=imagecreatefromjpeg($filename); imagecopyresampled($thumb,$source,0,0,0,0,$newWidth,$newHeight,$width,$height); imagejpeg($thumb);
相关文章推荐
- yii2 无法发送邮件的解决 can not send email
- php curl请求
- php+mysql实现事务回滚
- 40个迹象表明你还是PHP菜鸟
- PHP小菜鸟成长历程之wamp的伪静态和虚拟主机配置
- fastcgi与php-fpm关系
- 【转】写给系统管理员的 25 个 PHP 安全实践
- PHP小菜鸟成长历程之初识PHP
- PHP 开发者该知道的 5 个 Composer 小技巧
- php面向对象之序列化与反序列化
- phpunit.xml
- 在php 运行时间过长导致报错
- PHP代码优化技巧大盘点
- [转]Zend Studio 文件头和方法注释设置
- php 函数之 )_each()list()implode()explode()in_array()
- PHP命名空间和别名/导入(摘要)
- Proftp设置虚拟用户(转)
- PHP常用函数
- 处理内容有&特殊字符thinkphp返回xml无法解析的问题<![CDATA[xxx]]>
- php安装threads多线程扩展