Home Tutorial Php Phpgd PHP GD Image Resize

 
 

PHP GD Image Resize
Posted on: November 11, 2009 at 12:00 AM
Advertisement
This example shows how to Images resize and save image in php gd.

<?php

$file = 'images.jpg';

$save = 'new.jpg';

list($width, $height) = getimagesize($file) ;

$modwidth = 100;

$modheight = 100;

$tn = imagecreatetruecolor($modwidth, $modheight) ;

$image = imagecreatefromjpeg($file) ;

imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;

imagejpeg($tn, $save, 100);

echo("Image created and saved successfully.");

?>

After running the program you will get the following output

Advertisement

Related Tags for PHP GD Image Resize:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 11, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com