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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -