From:             sriram dot natarajan at gmail dot com
Operating system: unix/linux
PHP version:      5.3SVN-2009-09-28 (snap)
PHP Bug Type:     Feature/Change Request
Bug description:  PHP GD library can use underlying JPEG library's capability 
to prescale image

Description:
------------
GD library is commonly used in PHP5 applications for image processing.
When creating thumbnails from a large jpeg image, the original image
currently has to be decoded to a full-size copy before being resampled or
resized. This is a relatively expensive step. The underlying jpeg library
has a capability of prescaling an image when it is being decoded, so for
example the decoded image could be only 1/16 the size of the fullsize image
by prescaling by a factor of 4. This saves a substantial amount of cpu
time.

Expected result:
----------------
we can update php libgd library and our php gd extension to leverage
underlying jpeg's ability to prescale image at the time of creating jpeg
images. 

for example, we can introduce new API or patch our existing
gdImageCreateFromJpeg API to have an extra argument for prescale size so
that we can set the value of 'prescale' value like below

cinfo.scale_denom = prescale;

before calling "jpeg_start_decompress (&cinfo)" function. 

[credits: thanks to Richard Smith for coming up with this nice
suggestion]

af course, this will allow users to invoke our 'imagecreatefromjpeg' with
an optional argument which specifies the prescale size of this jpeg. 

$src_img=imagecreatefromjpeg($name, 4);

Actual result:
--------------
better performance while producing jpeg based thumbnails 

-- 
Edit bug report at http://bugs.php.net/?id=49696&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49696&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49696&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49696&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49696&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49696&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49696&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49696&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49696&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49696&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49696&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49696&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49696&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49696&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49696&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49696&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49696&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49696&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49696&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49696&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49696&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49696&r=mysqlcfg

Reply via email to