Skip to content
This repository has been archived by the owner on Oct 13, 2020. It is now read-only.

Jpeg_quality #120

Open
Colir opened this issue Jan 28, 2015 · 5 comments
Open

Jpeg_quality #120

Colir opened this issue Jan 28, 2015 · 5 comments

Comments

@Colir
Copy link

Colir commented Jan 28, 2015

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...

@ambienthack
Copy link

Same issue. Same fix worked for me.

@rpetersn
Copy link
Contributor

THANK YOU! Working for me....

For reference, I added:

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

to wpthumb.php at around line 429

@willmot
Copy link
Member

willmot commented May 14, 2015

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

@sleepingkiwi
Copy link

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!

@Colir
Copy link
Author

Colir commented Oct 14, 2015

+1

leepeterson pushed a commit to leepeterson/WPThumb that referenced this issue Dec 21, 2017
Related to humanmade#120 (humanmade#120)

To get the quality argument to apply for images other than gifs, move the line $editor->set_quality( $this->args['jpeg_quality'] ); below the line:
apply_filters( 'wpthumb_image_pre', $editor, $this->args );
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants