1

There is a blog where high quality images (300KB at 800x550) are being uploaded and embedded at Full Size. Wordpress will just use the exact uploaded picture when you embed at Full Size. This makes total sense, but I'd like to override that and force it to generate and use a more optimised image. Is there a way to process these Full Size images to present a lower quality, say 70%? I don't want to resize them.

Sob story below:

I have a client who runs a very popular blog, with lots of photos on it. I've instructed them many times about saving at an appropriate quality for the web, but they have been "forgetting" for 6 months now. Yet they complain about their site being slow - hardly surprising when it has between 1 and 4 megs of 100% quality JPEGs on the page, which can easily be reduced to 100-200KB without any visible loss of quality. At this point I have to assume that they're never going to change their habits, so I'm trying to find an automated solution.

1 Answer 1

1

Yes, there is actually a filter hook to change JPEG compression ratio. You could add these lines to your functions.php:

add_filter( 'jpeg_quality', 'jpeg_custom_quality' );
function jpeg_custom_quality( $quality ) {
    return 70;
}

You may change 70 to whatever value you want.

2
  • Unfortunately, this doesn't affect images that are embedded at Full Size. Wordpress just uses the uploaded image, which would normally make perfect sense. I'm looking for something that will override that functionality. Commented Sep 20, 2013 at 15:12
  • @Magnakai you can create a custom size with reasonable big sizes for width and height, and then add a filter to force retrieve that size when 'full' size is required.
    – gmazzap
    Commented Sep 20, 2013 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.