Page size too big due to images

admin2025-06-06  1

I hope it's a fitting question to be asked here. My website loads the images and then resizing them. So what happens is the image is loaded full sized and then reduced. I have lots of images already and it won't be relevant to re-upload all the images.

Is there a setting, code or plugin which will allow me to reduce the images according to the needs before it loads?

Now I am getting page size of 68MB(!).

Thanks.

I hope it's a fitting question to be asked here. My website loads the images and then resizing them. So what happens is the image is loaded full sized and then reduced. I have lots of images already and it won't be relevant to re-upload all the images.

Is there a setting, code or plugin which will allow me to reduce the images according to the needs before it loads?

Now I am getting page size of 68MB(!).

Thanks.

Share Improve this question asked Nov 1, 2018 at 7:56 OmerOmer 1491 gold badge4 silver badges14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Responsive images are in WordPress core since 4.4

https://make.wordpress/core/2015/11/10/responsive-images-in-wordpress-4-4/

srcset and sizes are used to accomplish this.

If your theme doesn't implement these properly you will have to modify theme files.

<?php
// Specifying width of 400 (px) and height of 200 (px).
$srcset = wp_get_attachment_image_srcset( get_custom_header()->attachment_id, array( 400, 200 ) );
?>
<img src="<?php header_image(); ?>" srcset="<?php echo esc_attr( $srcset ); ?>">

https://developer.wordpress/reference/functions/wp_get_attachment_image_srcset/

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749215333a317329.html

最新回复(0)