php - Degrading a jpg image quality each time a user visits a page? -
php - Degrading a jpg image quality each time a user visits a page? -
i'm trying work out best way degrade quality of jpeg image in web page http://vimeo.com/3750507
is there server-side way of saving , re-saving @ lower quality displaying image each time page served?
thanks in advance.
the next script degrade original image 1 'quality point' on each page load, starting @ 99. isn't robust, should demonstrate concept.
warning: replace original image! utilize re-create if original important!
session_start(); if (empty($_session['quality'])) $_session['quality'] = 99; $file = 'degrade.jpg'; imagejpeg(imagecreatefromjpeg($file), $file, $_session['quality']); $_session['quality']--; header('content-type: image/jpeg'); echo file_get_contents($file);
on first page load:
tenth page load:
one hundredth page load:
php image-processing
Comments
Post a Comment