How to up-scale an image {PHP} -
i used code below image:
$url = "http://maps.googleapis.com/maps/api/staticmap?size=800x600&zoom=12¢er=(10.763705518561297,106.64444580078126)"; $content = file_get_contents($url);
i received 640px x 640px image meanwhile expected 800px x 600px one. how scale image 800px x 600px?
try doing this:
<?php // file , new size $filename = 'test.jpg'; $percent = 0.5; // content type header('content-type: image/jpeg'); // new sizes list($width, $height) = getimagesize($filename); $newwidth = $width * $percent; $newheight = $height * $percent; // load $thumb = imagecreatetruecolor($newwidth, $newheight); $source = imagecreatefromjpeg($filename); // resize imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); // output imagejpeg($thumb); ?>
here, rescaling done 50%, can change parameter per requirement. can use imagick image manipulation. see, if helps.
referred: php manual
Comments
Post a Comment