php resize image based on weight on page php -


i need resize image based on weight on page php.

ex: have image of 10mb, when upload image want resize 5mb.

it's possible?

<?php header('content-type: image/jpeg'); $filename = 'http://www.yoursite.com/images/cowboybebop27.jpg'; $image = imagecreatefromjpeg($filename); $dest='temp_image.jpg'; imagejpeg($image, null, 10); imagejpeg($image, $dest, 10); ?> 

the above code pull image , save @ file location of temp_image.jpg.

 imagejpeg($image, null, 10); //this line displays image quality of 10% 1/10 original file size well.  imagejpeg($image, $dest, 10); //this line saves image image quality of 10%. 

see here


Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -