Bug Report – Workaround
-
Using plugin version 1.0 with WordPress 3.5.2 was serving up corrupted images – I traced it to WordPress having erroneous things in the output buffer. Also the plugin didn’t change the status code to 200 (instead it was left at 404, not really a critical problem though).
Solution was to change the end of the dynimg_404_handler() function to look like this:
// serve the image this one time (next time the webserver will do it for us) header_remove(); flush(); ob_end_clean(); status_header( '200' ); header( 'Content-Type: '.$type ); header( 'Content-Length: ' . filesize($resized) ); readfile($resized); exit;
Also, WordPress now has the image_resize function listed as deprecated, so I updated that section as well:
if ( file_exists($basefile) ) { // we have the file, so call the wp function to actually resize the image //OLD function $resized = image_resize($basefile, $width, $height, $crop, $suffix); $editor = wp_get_image_editor( $basefile ); $editor->set_quality( 90 ); $resized = $editor->resize( $width, $height, $crop ); if ( is_wp_error( $resized ) ) return $resized; $dest_file = $editor->generate_filename( $suffix, null ); $editor->save( $dest_file ); $resized = $dest_file;
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
- The topic ‘Bug Report – Workaround’ is closed to new replies.