Home Tutorial Php Phpgd PHP GD imagecopyresampled

 
 

Share on Google+Share on Google+
PHP GD imagecopyresampled
Posted on: November 7, 2009 at 12:00 AM
Advertisement
This example shows how to image copy re-sampled in php gd.

<?php

$filename = 'image1.jpg';

$percent = 0.2;

header('Content-type: image/jpeg');

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

$new_width = $width * $percent;

$new_height = $height * $percent;

$image_p = imagecreatetruecolor($new_width, $new_height);

$image = imagecreatefromjpeg($filename);

imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

imagejpeg($image_p, null, 100);

?>

After running the program you will get the following output

Advertisement

Related Tags for PHP GD imagecopyresampled:


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 7, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com