WPThumb
WPThumb copied to clipboard
Jpeg_quality
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...
Same issue. Same fix worked for me.
THANK YOU! Working for me....
For reference, I added:
$editor->set_quality($this->args['jpeg_quality']);
to wpthumb.php at around line 429
If one of you fancies having a bash at sending a Pull Request be happy to merge 👍
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!
+1