Install Imagick pada Zend Core
Ada Pada Kategori: Ilmu Pengetahuan : Web Programming
Alhamdulillah, setelah susah payah tengok kiri tengok kanan, akhirnya ketemu juga cara ngintegrasikan imagick (image magick) dengan Zend Core. Zend Core sendiri sudah teritegrasi dengan php_imagick.dll tapi, karena menggunakan windows, harus ditambah dengan beberapa komponen penunjang dari imagick itu sendiri. bagaimana caranya?
Langkah-langkahnya adalah sebagai berikut:
- Install zend core dari www.zend.com
- Aktifkan ekstensi imagick pada zend core administration (di website ketik aja http://localhost/ZendServer
- Download imagick di http://www.imagemagick.org/script/binary-releases.php#windows
Versi yang saya gunakan adalah ImageMagick-6.4.6-0-Q16-windows-dll.exe
sesuai dengan versi dll dari imagick di Zend Core
- Install binary windows tersebut, saya menginstall di F:/imagick
- Restart komputer terlebih dahulu
- Copy semua file pada folder imagick/modules/coder/* ke root directory dari folder instalasi imagick (dalam hal ini F:/imagick)
- Copy lagi semua file pada folder imagick/modules/filters/* ke root directory dari folder instalasi imagick (dalam hal ini F:/imagick)
- Restart Apache, coba lihat di phpinfo(), kalau ada ekstensi imagick, berarti sudah benar instalasinya
- Jika pada ekstensi imagick tersebut ImageMagick Number of supported formats: bukan 0 (nol) maka selamat anda dapat menjalankannya
- Saya coba dengan script berikut:
< ?php
/* Read the image */
$im = new Imagick(”aidiCMS.png”);/* Thumbnail the image */
$im->thumbnailImage(200, null);/* Create a border for the image */
$im->borderImage(new ImagickPixel(”black”), 5, 5);/* Clone the image and flip it */
$reflection = $im->clone();
$reflection->flipImage();/* Create gradient. It will be overlayd on the reflection */
$gradient = new Imagick();/* Gradient needs to be large enough for the image and the borders */
$gradient->newPseudoImage($reflection->getImageWidth() + 10,
$reflection->getImageHeight() + 10, “gradient:transparent-black”);/* Composite the gradient on the reflection */
$reflection->compositeImage($gradient, imagick::COMPOSITE_OVER, 0, 0);/* Add some opacity. Requires ImageMagick 6.2.9 or later */
$reflection->setImageOpacity( 0.3 );/* Create an empty canvas */
$canvas = new Imagick();/* Canvas needs to be large enough to hold the both images */
$width = $im->getImageWidth() + 40;
$height = ($im->getImageHeight() * 2) + 30;
$canvas->newImage($width, $height, new ImagickPixel(”black”));
$canvas->setImageFormat(”png”);/* Composite the original image and the reflection on the canvas */
$canvas->compositeImage($im, imagick::COMPOSITE_OVER, 20, 10);
$canvas->compositeImage($reflection, imagick::COMPOSITE_OVER, 20,
$im->getImageHeight() + 10);/* Output the image*/
header(”Content-Type: image/png”);
echo $canvas;
?> - Selamat, anda dapat menjalankan imagick pada server windows anda
Posted By aidi
|






Posted By aidi
