脚本宝典收集整理的这篇文章主要介绍了PHP实现原比例生成缩略图的方法,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
本文实例讲述了PHP实现原比例生成缩略图的方法。分享给大家供大家参考,具体如下:
PHP;"> $y){ //图片宽大于高 $sx = abs(($y-$x)/2); $sy = 0; $thumbw = $y; $thumbh = $y; } else { //图片高大于等于宽 $sy = abs(($x-$y)/2.5); $sx = 0; $thumbw = $x; $thumbh = $x; } if(function_exists("imagecreatetruecolor")) { $dim = imagecreatetruecolor($yy,$xx); // 创建目标图gd2 } else { $dim = imagecreate($yy,$xx); // 创建目标图gd1 } imageCopyreSampled ($dim,$im,$sx,$sy,$yy,$xx,$thumbw,$thumbh); header ("Content-type: image/jpeg"); imagejpeg ($dim,false,100); ?>
以上是脚本宝典为你收集整理的PHP实现原比例生成缩略图的方法全部内容,希望文章能够帮你解决PHP实现原比例生成缩略图的方法所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。