最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php imagecopyresized实例
时间:2022-07-02 09:54:02 编辑:袖梨 来源:一聚教程网
imagecopyresized实例
描述
布尔imagecopyresized($ dst_image,$ src_image,$ dst_x,$ dst_y,$ src_x,$
src_y,$ dst_w,$ dst_h,$ src_w,$ src_h)
imagecopyresized()拷贝一个长方形的部分图像到另一个图像。 dst_image的目标图
像,src_image是源图像的标识符。
换句话说,imagecopyresized()将于src_w的宽度和高度src_h src_image的位置
(src_x,src_y),并将其放置在dst_w的宽度和高度dst_h dst_image矩形区域,它是
在位置的矩形区域(dst_x,dst_y)。
如果源和目标坐标,宽度和高度不同,适当的伸展或收缩的图像片段将进行。坐标是指
在左上角。该功能可用于复制的图像在同一地区(如dst_image是相同的src_image),
但如果区域重叠的结果将不可预测。
参数说明:
dst_im
目标图像链接的资源。
src_im
源图像链接的资源。
dst_x
X坐标的目的地。
dst_y
y坐标目的地。
src_x
X坐标的源点。
src_y
y坐标源点。
dst_w
目的地宽度。
dst_h
目标高度。
src_w
源宽度。
src_h
源高度。
来看看imagecopyresized函数实例
// File and new size
$filename = 'test.jpg';
$percent = 0.5;
// Content type
header('Content-type: image/jpeg');
// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width,
$height);
// Output
imagejpeg($thumb);
?>
相关文章
- jk漫画最新版本下载安装入口-jk漫画官方正版下载安装详细教程 01-29
- outlook邮箱登录-微软官方outlook登录入口 01-29
- 豆包官网网页版入口-豆包AI在线网页版入口 01-29
- 君有疾否原著小说下载-君有疾否原著未删减小说txt免费下载地址 01-29
- 王者荣耀云游戏极速入口-王者荣耀云端畅玩开黑免下载直达 01-29
- 即梦AI电脑版登录入口-即梦AI网页版官方入口 01-29