[wp-trac] [WordPress Trac] #21668: WordPress still does not save jpeg as progressive jpeg

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 24 13:40:23 UTC 2012


#21668: WordPress still does not save jpeg as progressive jpeg
-------------------------+------------------------------
 Reporter:  _ck_         |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Media        |     Version:  3.4.1
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------------------

Comment (by _ck_):

 Replying to [comment:5 SergeyBiryukov]:

 Thanks for making a patch - I would disagree with the patch for `wp-
 admin/includes/image.php` because interlace should only be set
 specifically before imagejpeg and nothing else as gif and png progressive
 support is spotty.

 Basically anywhere `imagejpeg` is found in WP code, either a filter-by-
 reference should be done beforehand or `imageinterlace` set.

 I am uncertain if an apply_filters will obey a php function that is
 declared as `function foo(&$var)` and really pass it by reference or first
 make a copy of the variable it's passed and then try to pass that copy by
 reference to the function. `$newimage` almost certainly has to be passed
 by reference and not a copy (but I could be wrong).

 We could test this theory easily:
 ie. in `media.php`

 {{{

 add_filter('imagejpeg','setprogressive');
 function setprogressive(&$handle) {
   if (function_exists('imageinterlace')) {imageinterlace($handle,1);}
 }
 ...
 apply_filters('imagejpeg',$newimage); // no need to return variable if
 it's by reference?
 imagejpeg( $newimage, ...

 }}}


 If the image produced is progressive, then it works.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21668#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list