How to use PHP & Resize image
How to use PHP & Resize image The guideline/example scripts how to using PHP and GD , Resize image
Example
php_resize.php
- <?
- $images = "mygirl.jpg";
- $new_images = "MyResize/mygirl.jpg";
- $width=200; //*** Fix Width & Heigh (Auto calculate) ***//
- $size=GetimageSize($images);
- $height=round($width*$size[1]/$size[0]);
- $images_orig = ImageCreateFromJPEG($images);
- $photoX = ImagesX($images_orig);
- $photoY = ImagesY($images_orig);
- $images_fin = ImageCreateTrueColor($width, $height);
- ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
- ImageJPEG($images_fin,$new_images);
- ImageDestroy($images_orig);
- ImageDestroy($images_fin);
- ?>
- <b>Original Size</b><br>
- <img src="<?=$images;?>">
- <hr>
- <b>New Resize</b><br>
- <img src="<?=$new_images;?>">
Create a php file and save to path root-path/myphp/
Screenshot
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment