incubator-pagespeed-ngx icon indicating copy to clipboard operation
incubator-pagespeed-ngx copied to clipboard

convert_jpeg_to_webp not working!?

Open ZTzha opened this issue 6 years ago • 6 comments

/img/1.jpg ->working
chrome get ->img/x1.jpg.pagespeed.ic.oi_Bc-Td8w.webp 1.jpg original-size:59.27KB 800x500 1.jpg.webp size: 9.7KB 800x500

that's great, but:

/img/4.jpg -> not working chrome get ->img/4.jpg 4.jpg original-size:4.19MB 7952x5304

no error.log

second problems: html-code--> img src="http://x.x.x.x/img/test.jpg" x.x.x.x is not my server. jpeg_to_webp not working... chrome still get original image,and show Request Headers "Provisional headers are shown" /var/cache/ngx_pagespeed does not get test.jpg,

my nginx.conf ----->

server { listen 1159;

location / {

root html;
index  index.html index.htm;

pagespeed EnableFilters recompress_images;
	pagespeed EnableFilters convert_gif_to_png;
	pagespeed EnableFilters convert_jpeg_to_webp;
	pagespeed EnableFilters recompress_webp;
	pagespeed ImageRecompressionQuality 10;

}

location ~ ".pagespeed.([a-z].)?[a-z]{2}.[^.]{10}.[^.]+" { add_header "" ""; }
location ~ "^/ngx_pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon" { }

}

nginx-version: 1.15.8 ngx_pagespeed-version: 1.13.35.2-stable operation-system: centos 7

ZTzha avatar Jan 10 '19 03:01 ZTzha

If you enable the debug filter, html comments will be written right after the img tags that may shed some light on what happens and why.

oschaaf avatar Jan 10 '19 22:01 oschaaf

first problem image debug: The image was not inlined because you have chosen to only inline the critical images but this image is not critical.

second problem image debug: The preceding resource was not rewritten because its domain (x.x.x.x) is not authorized

how can i solve it @oschaaf

ZTzha avatar Jan 11 '19 00:01 ZTzha

Hi @ZTzha The message say that you enabed the inline_images but not configured the pagespeed pagespeed ImageInlineMaxBytes MaxBytes; so the default size is 2048 bytes and the image is greater than that. If you don´t see these image optimized can be because it need some it to optimze resources. Some image filters need that pagespeed CriticalImagesBeaconEnabled true; be enabled to work. The second issue is not solvable unless in that domain pagespeed module is working. If you authorize these domain (pagespeed Domain http://x.x.x.x;) then pagespeed request a rewrited resource and the original server say 404 resource not found because it don understand rewrited url.

Lofesa avatar Jan 11 '19 10:01 Lofesa

Hi @Lofesa As you advice,I add the config “pagespeed CriticalImagesBeaconEnabled true;” and “pagespeed ImageInlineMaxBytes 102400000000;”,and close passthrough, then reload my nginx. refresh my test-website 3 times, /img/4.jpg change to img/4.jpg.pagespeed.ce.k_vyVMeiuE.jpg but the image size still 4.2MB and jpg not convert to webp and show debug The image was not inlined because it has too many bytes. I think i set the MaxBytes is enough

ZTzha avatar Jan 12 '19 01:01 ZTzha

/img/4.jpg change to img/4.jpg.pagespeed.ce.k_vyVMeiuE.jpg The xx.ce.xx is cache extend, this image only had applied the cache extender filter. Well... the image is 7952x5304 = 42.177.408 Try to use pagespeed ImageResolutionLimitBytes 45.000.000, by default these value is 32.000.000 And the max size an object can use in cache is determined by pagespeed MaxCacheableContentLength 16777216; So you can use the -1 value to this param to have no limit in the size of objects stored in pagespeed cache.

Lofesa avatar Jan 12 '19 11:01 Lofesa

@Lofesa thank you very much!it is great solution for my problem

ZTzha avatar Jan 14 '19 01:01 ZTzha