修改ecshop 缩略图的图片裁剪缩放处理方式
ECSHOP 做为一款重要的商城CMS ,整个设计和代码的确很严谨和规范,,
但因为需要不一样,还是有很多地方要涉及代码的修改,,
就像这个缩略图片的缩略方式,
ecshop缩略图片是 原始图片比较高,则以高度为准,原始图片比较宽,则以宽度为准生成缩略图,这种方式基本我个人不是很喜欢,因为长度不一样,看起来一点都不整齐,于是我自己就开始改了,,
ecshop缩略图片用的 PHP函数? imagecopyresampled?–?重采样拷贝部分图像并调整大小
这个定义是
将一幅图像中的一块正方形区域拷贝到另一个图像中,平滑地插入像素值
其实我对这个也不太清楚,,好了,我们找到这里,下面的这些代码是处理,
1 打开/includes/ cls_image.php 这个文件,找到代码中处理缩略尺寸的代码,
if ($org_info[0] / $thumb_width > $org_info[1] / $thumb_height)
{
$lessen_width? = $thumb_width;
$lessen_height? = $thumb_width / $scale_org;
}
else
{
/* 原始图片比较高,则以高度为准 */
$lessen_width? = $thumb_height * $scale_org;
$lessen_height = $thumb_height;
}
把红色部分的换成绿色的
if ($org_info[0] / $thumb_width > $org_info[1] / $thumb_height)
{
$lessen_width? = $thumb_width; $thumb_height * $scale_org;
$lessen_height? = $thumb_width / $scale_org; $thumb_height;
}
else
{
/* 原始图片比较高,则以高度为准 */
$lessen_width? = $thumb_height * $scale_org; $thumb_width;
$lessen_height = $thumb_height; $thumb_width / $scale_org;
}
你也可以直接COPY过去,,
if ($org_info[0] / $thumb_width > $org_info[1] / $thumb_height)
{
/* 原始图片比较宽时,则以高度为准 doff.com.cn 修改 */
$lessen_width? = $thumb_height * $scale_org;
$lessen_height? = $thumb_height;
}
else
{
/* 原始图片比较高,则以宽度为准 由doff.com.cn 修改 */
$lessen_width? = $thumb_width;
$lessen_height = $thumb_width / $scale_org;
}
现在的看来起好多了,,
上海商派网络科技有限公司有申明,因为ECSHOP并非自由软件,所以DOFF这里不能提供修改好的文件下载,想变动的大家自己去修改吧,
By 韩国童装批发, 2010年09月1日 @ 2:36 上午
呵呵,我的商品都是采集的时候自动生成缩略图,大小自己控制!!暂时用不到这个功能!!
By Elvia Dickerman, 2011年02月11日 @ 8:12 上午
Thank You for this article and please allow me to have the opportunity to show my satisfaction with Host Gator web hosting. They offer professional and instant support and they also offering many HostGator discount coupons.
By asics shoes wrestling, 2011年04月1日 @ 10:16 下午
这个很给力,不错,学习了