PHP圖像處理庫:Imagine
Imagine 是 PHP 一個強大的圖像處理庫,要求 PHP 5.3 及更新版本,其靈感來自于 Python 的 PIL。
基于以下依賴:
- GD2
- Imagick
- Gmagick
示例代碼:
<?php $imagine = new Imagine\Gd\Imagine(); // or $imagine = new Imagine\Imagick\Imagine(); // or $imagine = new Imagine\Gmagick\Imagine(); $size = new Imagine\Image\Box(40, 40); $mode = Imagine\Image\ImageInterface::THUMBNAIL_INSET; // or $mode = Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND; $imagine->open('/path/to/large_image.jpg') ->thumbnail($size, $mode) ->save('/path/to/thumbnail.png') ;
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!