脚本宝典收集整理的这篇文章主要介绍了我如何在php中使用imagick? (调整大小和作物),脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在考虑调整图像的大小,然后裁剪.另外,我需要保持图像的大小比例.
以下是我用于作物的PHP脚本:
$im = new imagick( "img/20130815233205-8.jpg" ); $im->cropThumbnailImage( 80,80 ); $im->wrITeimage( "thumb/th_80x80_test.jpg" ); echo '<img src="thumb/th_80x80_test.jpg">';
谢谢..
$im = new imagick("c:\\temp\\523764_169105429888246_1540489537_n.jpg"); $imagePRops = $im->getImageGeometry(); $width = $imageprops['width']; $height = $imageprops['height']; if($width > $height){ $newHeight = 80; $newWidth = (80 / $height) * $width; }else{ $newWidth = 80; $newHeight = (80 / $width) * $height; } $im->resizeImage($newWidth,$newHeight,imagick::FILTER_LANCZOS,0.9,true); $im->cropImage (80,80,0); $im->writeImage( "D:\\xampp\\htdocs\\th_80x80_test.jpg" ); echo '<img src="th_80x80_test.jpg">';
(测试)
以上是脚本宝典为你收集整理的我如何在php中使用imagick? (调整大小和作物)全部内容,希望文章能够帮你解决我如何在php中使用imagick? (调整大小和作物)所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。