Wednesday, February 28, 2018

Resize image in php.

First you enable following extension in php.ini file  if exist else install php imagick in 
you server :-

set in php.ini file :-

extension=php_imagick.dll


<?php

$thumb = new Imagick();

$thumb->readImage(product_image1);
$thumb->resizeImage(100,100,Imagick::FILTER_LANCZOS,1);
$thumb->writeImage('new100x100.jpeg');


$thumb->readImage(product_image1);
$thumb->resizeImage(200,200,Imagick::FILTER_LANCZOS,1);
$thumb->writeImage('new200x200.jpeg');
$thumb->destroy();

?>

No comments:

Post a Comment