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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -