How to resize the image via php script

advertisements

I am creating a app which requires to convert a large image to thumbnail through php script and then encode it to base64 so that i can send it through the json to my android app. I am having problem with resizing the image. I need php script which help me do that


You can try this Image Resize function tutorial

And also you can used this code for resize function(GD).

<?php

$thumb = new Imagick();
$thumb->readImage('myimage.gif');    $thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1);
$thumb->writeImage('mythumb.gif');
$thumb->clear();
$thumb->destroy(); 

?>

Or, a shorter version of the same:

<?php

$thumb = new Imagick('myimage.gif');

$thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1);
$thumb->writeImage('mythumb.gif');

$thumb->destroy(); 

?>

And also refer this links for Resize image

1.YETANOTHERLinks

2.9Lession

And also converting Base64 for image Refer this Links