WPThumb icon indicating copy to clipboard operation
WPThumb copied to clipboard

Jpeg_quality

Open Colir opened this issue 10 years ago • 5 comments

Hi It appear that the attribut 'jpeg_quality' it isn't used in the wp-thumb class. ex : $image_url = wp_get_attachment_image_src($img_id,'width='.$atts['width'].'&height='.$atts['height'].'&crop=true&jpeg_quality=50');

This doesn't affect the quality.

To work correctly, i've added this on the wp-thumb class $editor->set_quality($this->args['jpeg_quality']); in the method 'generateCacheFile'.

Now, this is working.

However, i ask me if this is not a voluntary forget...

Colir avatar Jan 28 '15 14:01 Colir

Same issue. Same fix worked for me.

ambienthack avatar Jan 29 '15 04:01 ambienthack

THANK YOU! Working for me....

For reference, I added:

$editor->set_quality($this->args['jpeg_quality']);

to wpthumb.php at around line 429

rpetersn avatar May 14 '15 17:05 rpetersn

If one of you fancies having a bash at sending a Pull Request be happy to merge 👍

willmot avatar May 14 '15 17:05 willmot

Correct me if I'm wrong but I believe that recent PR only applies the quality change if the image is a .gif? It appears inside the statement at line 425: if ( $this->getFileExtension() == 'gif' ) :

To get the quality argument to apply for images other than gifs I had to move the line $editor->set_quality( $this->args['jpeg_quality'] ); outside of that if statement.

Additionally I'd recommend moving it below the line: apply_filters( 'wpthumb_image_pre', $editor, $this->args ); as I believe the intent of that filter is to give users a chance to step in and make changes before any alterations have been made to the image by WPThumb?

Would be happy to send a PR with those changes if I haven't missed the point somewhere!

sleepingkiwi avatar Jun 03 '15 13:06 sleepingkiwi

+1

Colir avatar Oct 14 '15 12:10 Colir