Image,Resizer,php

Patrick64 10/4/2016 0

Image Resizer in PHP

PHP
<?php

// File and new size
//$imgfile = 'smp.jpg';
//$percent = 0.2;
header('Content-type: image/jpeg');

list($width, $height) = getimagesize($imgfile);
$newwidth = $width * $percent;
$newheight = $height * $percent;

$thumb = ImageCreateTrueColor($newwidth,$newheight);
$source = imagecreatefromjpeg($imgfile);

imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

imagejpeg($thumb);
?>
 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments