0

Images that are above 1MB get automatically compressed on upload. Images that are smaller than 1MB are added to the database in their raw form.

So, if someone uploaded a 900 KB image, the post will display a 900 KB image.

On this website, all content is user-generated. Both posts and comments have many images. They have to be automatically compressed by WordPress on upload.

Please, tell me how to change this setting so that all image sizes are compressed.

2
  • WordPress generates resized versions of images but I don't think it actually compresses the original uploaded image (the size='full' image) if that's what you meant. What exactly do you mean by compressed - resized, resaved as JPGs, maybe with a lower quality, something else? By any chance is it your user-generated-content plugin that's doing this?
    – Rup
    Commented Aug 14, 2021 at 13:56
  • There is no such setting, that's not how WP image uploading works
    – Tom J Nowell
    Commented Aug 14, 2021 at 15:55

1 Answer 1

1

The closest answer you will find to the exact question you asked is: that feature does not exist, WordPress does not have an image compression feature.

That's not how compression works, compression isn't something WP does. Your understanding of how WordPress handles image uploads, and your expectations, are incorrect.

WP does not store images in the database, they're stored on the file system and represented by a post of type attachment.

WP also preserves the original uploaded file unmodified, it is only the additional image sizes that are created, and because they are JPEG's you need to specify a compression value when they're created. This is usually the "full" image size, and it is always kept. Without this, it would be impossible to regenerate thumbnails if their dimensions were changed, or add new image sizes for already uploaded items.

So there is no compression step, it's just a side effect of the creation of these additional image size files, not a dedicated feature or step.

If your images dimensions are too small to create these image sizes then no new image sizes are created as that would require upscaling.

Additionally, if your image consumes too much memory to decompress and modify then image sizes can't be created.

For this reason, this sentence makes no sense:

Please, tell me how to change this setting so that all image sizes are compressed.

There is no such setting, that's not how image sizes work. There is a filter to change the percentage, but the default is 70%, so it will not enable compression as you are hoping. Compression is not something that is enabled or disabled, that's just not how image uploads work in WordPress.

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.