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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

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

c# - Search and Add Comment with OpenXML for Word -