--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/146cc0d7-5bd2-476f-83a6-fae8f68983f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Otto and thank you for the response!
We are using the resize_rendered_image_dimensions and do not add the image sizes on the image itself since we want the image to fit the screen size on the various devices through width in percentage. Per my understanding this should be sufficient to resize the image. Note the width is defined on the CSS files.
We have made 10 requests with an interval of 2 seconds in between, to the page and the image is not resized. Also, the beacon is passed through nicely to the server returning 204.
In terms of the configuration, we hardly changed it from the original configuration, here is the diff:
$ diff /etc/httpd/conf.d/pagespeed.conf /vendors/etc/httpd/conf.d/pagespeed.conf
89,93c89
< ModPagespeedEnableFilters collapse_whitespace,elide_attributes,trim_urls
< ModPagespeedEnableFilters resize_rendered_image_dimensions
< ModPagespeedEnableFilters remove_quotes,remove_comments
< ModPagespeedEnableFilters insert_dns_prefetch
< #ModPagespeedEnableFilters debug
---
> # ModPagespeedEnableFilters collapse_whitespace,elide_attributes
Did you configure the resize_rendered_image_dimensions filter? Or resize_images? (or both?)resize_rendered_image_dimensions uses beaconing to determine actual rendered image dimensions, but resize_images depends on the width and height attributes declared in html.Also, resize_rendered_image_dimensions may need a few page reloads in the browser before it takes effect as it relies on the browser beaconing back the rendered dimensions to mod_pagespeed.Otto
On Mon, Jun 13, 2016 at 2:18 PM, <mick...@kikuta2008.com> wrote:
Hi,We have recently upgraded to to mod_pagespeed 1.11.33.2-0 and images are not being resized. When we run the server with debug filter on it says "Image does not appear to need resizing." even though the images do require a resize.Note several points, not sure if they are related or not, but I thought mentioning anyway:
- on the first request we get the message "filter timeout exceeded".
- we first requested the same page as a desktop, than requested the page through chrome mobile emulator through the same browser (we deleted the cookies and still got the same result, just in case you save the browser dimensions on a cookie).
- another image on the page was resized, but to a wrong size (see last screenshot)
See attached screenshots of the html with the comments and the image sizes.If you can please advise us how to proceed in order to overcome this problem we would be very thankful :-)Mickey.
--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.
<script>function resizeImage(img) {var originImage = img.getAttribute('data-hack-src');if (!originImage) {return;}// If the data-hack-src has been not been optimized yet, use the origin image.if (originImage.indexOf('.pagespeed.') == -1) {img.src = originImage;return;}var slash = originImage.lastIndexOf('/');var path = '';if (slash != -1) {path = originImage.substr(0, slash + 1);originImage = originImage.substr(slash + 1);}var newSrc = path + img.clientWidth + 'x' + img.clientHeight + originImage;if (img.src != newSrc) {img.src = newSrc;img.removeAttribute('data-hack-src');}}</script><img data-hack-src="images/Puzzle.jpg"style="width:100%;"onload="resizeImage(this);" />
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/146cc0d7-5bd2-476f-83a6-fae8f68983f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/8f222190-c7ff-456b-86b8-e940ce8c67fa%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/146cc0d7-5bd2-476f-83a6-fae8f68983f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.
Hi JMarantz and thank you for the elaborated reply!I'll try to focus my feedback per your points. I will also update you on our implementation of your suggested prototype on a followup email later on.>mod_pagespeed doesn't know the client screen width when it rewrites the HTML. Beacons don't help with your use-case (sized proportional to screen)Wow, when I saw this filter I was under the impression it gathers statistical data of required image size per [page X image X user-agent X rotated] (or alternatively [page X image X viewport-size]) and deliver the appropriate size, either through JS or even apache (using the UA data) altering the html. If you do it via apache, you can add both landscape and portrait urls to the image property (srcset?) and the JS can decide which to use based on the actual rotation.
Question -- if we use the image onload event, wouldn't the JS be run after the image was already loaded to the browser?
A question with regards to mps implementation -- if we request an image sized 111x222 on the url, would pagespeed create for us that image?
>One thing that wont work is using a one pixel image having 100%, as you hinted, not all our images are styled to be 100% width...
Just to clarify, I meant "One thing that wont work is using a one pixel image having 100%. As you hinted, not all our images are styled to be 100% width..." :-)
function resizeImage(image){
var orgSrc = image.getAttribute("originalsrc");
// processing is complete
if (!orgSrc)
return;
// not supported.
if (!isResizeImageSupported(orgSrc)){
image.src = orgSrc;
image.removeAttribute("originalsrc");
// start processing
} else if (image.getAttribute("imagew")) {
image.src = getDummyImage(image);
// finish processing
} else {
image.src = getResizedImageUrl(image);
}
}
function getDummyImage(image){
var canvas = document.createElement("canvas");
canvas.width = image.getAttribute("imagew");
canvas.height = image.getAttribute("imageh");
image.removeAttribute("imagew");
image.removeAttribute("imageh");
return canvas.toDataURL("image/png");
}
function getResizedImageUrl(image){
var file = image.getAttribute("originalsrc").replace( /.*\//, "" ).replace( /^\d+x\d+x/, "x" );
var path = image.getAttribute("originalsrc").replace( /(.*\/)?.*/, "$1" );
image.removeAttribute("originalsrc");
return path + Math.floor(image.clientWidth) + "x" + Math.floor(image.clientHeight) + file;
}
function isResizeImageSupported(orgSrc){
var canvas = document.createElement("canvas");
return typeof document.body.clientWidth != "undefined" && typeof canvas !="undefined" && typeof canvas.toDataURL !="undefined" && orgSrc.match(/pagespeed/);
}
--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/d72db66a-2928-4c70-8880-682ad41dd52d%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/b6a62722-0fbe-4771-a39f-e3c6e8da1b73%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.
>Varying on desired image size makes sense to me, if your app controls HTTP headers and sends the dimensions in a request header.
>- authorisation key in header ?
>- control on the logic of width give in header ?
Hello,
@jmarantz
Here is a scheme, picking from https://packetzoom.com/blog/which-android-http-library-to-use.html that show the workflow that I think should be used with other "pictures rendering" libraries.
The three have different caching strategies but resized pictures from server side should be helpfull for both. The three are able to use okHttp and modify headers so to send max-width
Should we open another topic ?
Thanks,
Eric
> Mickey -- you might want to CC yourself in that bug report so you can track further progress
Thanks :-)
--
You received this message because you are subscribed to a topic in the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mod-pagespeed-discuss/GbntPnwiGTU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/3d3c41ef-6eed-408e-a1b2-81122ca5e6f3%40googlegroups.com.