1)实现固定宽高的缩略图
a、得到一张原图资源

b、得到一个缩略图资源(较小)

c、图片采样复制:imagecopyresampled(缩略图资源,原图资源,缩略图开始放x,放y,原图采样起始x,起始y,缩略图存放宽,存放高,原图采样宽,采样高)

d、保存缩略图


e、销毁所有资源(原图和缩略图)

2)实现适配的缩略图(不变形)
缺点:缩略图有些部分需要进行额外填充(白色填充:补白)
等比例缩略图与固定缩略图制作区别:在于需要通过计算来得出缩略图的宽和高

a、得到一张原图资源
b、得到一个缩略图资源(较小)
c、图片采样复制:imagecopyresampled(缩略图资源,原图资源,缩略图开始放x,放y,原图采样起始x,起始y,缩略图存放宽,存放高,原图采样宽,采样高)
d、保存缩略图
e、销毁所有资源(原图和缩略图)
2)实现适配的缩略图(不变形)
缺点:缩略图有些部分需要进行额外填充(白色填充:补白)
等比例缩略图与固定缩略图制作区别:在于需要通过计算来得出缩略图的宽和高
本文标题:GD图像处理应用案例:缩略图的实现
本文链接:https://www.haomeiwen.com/subject/bmmzmftx.html
网友评论