Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

multiple references to the same small images all get inlined #199

Closed
GoogleCodeExporter opened this issue Apr 6, 2015 · 18 comments
Closed

Comments

@GoogleCodeExporter
Copy link

If I have a 1k image referenced 5 times it will be inlined 5 times, resulting 
in 5k bytes.   It would be better to leave it as an external resource.

You could argue that if a 500 byte image were referenced twice it might be a 
win to inline it, to save one potentially uncached http request, or we could 
just simplify it and say that multiply-referenced images should not be inlined.

Original issue reported on code.google.com by jmara...@google.com on 28 Jan 2011 at 4:44

@GoogleCodeExporter
Copy link
Author

I suspect this will be easy to fix given a fix for 198.

Original comment by jmaes...@google.com on 28 Jan 2011 at 7:23

@GoogleCodeExporter
Copy link
Author

Will be handled by the coming local storage fix though this might not be 
enabled for many people.
This needs investigation to determine if it is really a win and/or at what 
threshold it is a win.
Accordingly changing to enhancement and lowering the priority.

Original comment by matterb...@google.com on 9 Feb 2012 at 3:11

  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

@GoogleCodeExporter
Copy link
Author

dear mod_pagespeed team, 
   I have installed the latest mod_pagespeed and tried to enable the filter of local_storage_cache by add

ModPagespeedEnableFilters local_storage_cache

 into /etc/httpd/conf.d/pagespeed.conf

but failed when restart apache 

# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: [Mon Apr 02 05:27:05 2012] [warn] [mod_pagespeed 0.10.21.2-1503 
@931] Invalid filter name: local_storage_cache
Syntax error on line 48 of /etc/httpd/conf.d/pagespeed.conf:
Failed to enable some filters.
                                                           [FAILED]

I did not find many hints on this problems. I hope to collect some suggestions.
thanks a million for your assistance

Original comment by linxi...@gmail.com on 4 Jun 2012 at 2:23

@GoogleCodeExporter
Copy link
Author

Your error message indicates you are still using 0.10.21.2.  You need 0.10.22.4 
which was released on June 1.  Can you try updating again?

Original comment by jmara...@google.com on 4 Jun 2012 at 3:18

@GoogleCodeExporter
Copy link
Author

Thanks a lot for your quick response, and I will recompile them and update the 
result to you as soon as possible.

Original comment by linxi...@gmail.com on 4 Jun 2012 at 10:53

@GoogleCodeExporter
Copy link
Author

Note that local_storage_cache is still not really working even in 1.1.23.2.  
However we have addressed the issues and they will be fixed in 1.2, which is 
coming soon.

Original comment by jmara...@google.com on 28 Nov 2012 at 7:09

  • Added labels: Milestone-v24, release-note

@GoogleCodeExporter
Copy link
Author

No reply from the OP and I am 99% sure (:-) that local_storage_cache is 
/finally/ working in the forthcoming 1.1.24.x release, ergo I'm closing this.

Original comment by matterb...@google.com on 6 Dec 2012 at 9:37

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Please verify behavior on browser first-view (warm server cache) with multiple 
instantiated images.  We should ideally not have to repeat the image contents 
but can reference the same content multiple times.

Original comment by jmara...@google.com on 6 Feb 2013 at 10:46

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

We now have a dedup_inlined_images filter that handles this specific case: it 
will inline the first image then load subsequent ones from that one (using 
JavaScript).
It does rely on the URLs being exactly the same.

Closing due to inactivity. If the OP can enable and verify that would be great.

Original comment by matterb...@google.com on 26 Jun 2013 at 1:14

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by sligocki@google.com on 26 Jun 2013 at 3:32

  • Added labels: Milestone-v29
  • Removed labels: Milestone-v24

@GoogleCodeExporter
Copy link
Author

Have tried this on the latest beta version - the dedup_inlined_images filter 
seems to be enabled by default (as part of the core filters set?) but I am 
struggling on a page where there are multiple references to the same images - 
some show the <Img src as the link back ot the cached version on the server - 
others show <img src as blank, and simply display the ALT text on screen....

Original comment by rwap.services on 19 Jul 2013 at 3:37

@GoogleCodeExporter
Copy link
Author

Can you provide an URL, either here or by email to matterbury@google.com? 
thanks!

Original comment by matterb...@google.com on 19 Jul 2013 at 3:39

@GoogleCodeExporter
Copy link
Author

Actually - I have disabled this filter - it seems more to do with the 
interaction with ModPagespeedRewriteRandomDropPercentage 70

Original comment by rwap.services on 19 Jul 2013 at 3:42

@GoogleCodeExporter
Copy link
Author

Just to clarify: If you turn off dedup_inlined_images, that works OK?  And if 
you set ModPagespeedRewriteRandomDropPercentage 0 and turn on 
dedup_inlined_images, that also works OK?

Original comment by jmaes...@google.com on 19 Jul 2013 at 5:16

@GoogleCodeExporter
Copy link
Author

I probably need to do some more testing tomorrow - but yes, with 
dedup_inlined_images on and ModPagespeedRewriteRandomDropPercentage 0 it seems 
to work.

I have sent matt a link to the site (as he needs a login)...

Original comment by rwap.services on 19 Jul 2013 at 6:04

@GoogleCodeExporter
Copy link
Author

OK I have now done some more testing....

dedup_inlined_images on and ModPagespeedRewriteRandomDropPercentage 0 works
dedup_inlined_images on and ModPagespeedRewriteRandomDropPercentage 70 does not 
work

I then tried it with ModPagespeedDisableFilters dedup_inlined_images
dedup_inlined_images off and ModPagespeedRewriteRandomDropPercentage 0 works
dedup_inlined_images off and ModPagespeedRewriteRandomDropPercentage 70 does 
not work - 

When I say it does not work, I mean no image is displayed at all - just the ALT 
text appears on screen!

A look at the page source shows that whilst for some lines, I see:
<img src="themes/enuukGreen/img/CheckoutBlank.png.pagespeed.ce.sIfOyqnWd2.png" 
alt="Awaiting Checkout" title="Awaiting Checkout" 
pagespeed_url_hash="2023998047"/>

(which is correct)

For others, I see:
<img src="" alt="Awaiting Checkout" title="Awaiting Checkout" 
pagespeed_url_hash="2023998047"/>

Original comment by rwap.services on 21 Jul 2013 at 8:04

@GoogleCodeExporter
Copy link
Author

Just for completeness, with :

dedup_inlined_images on and ModPagespeedRewriteRandomDropPercentage 0

I see the image sources as:
<img 
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAC2ElEQ
VRIx+2Uz2tUVxTHP+feN+lkZuI0EyUaHat2UWtR8PdGtIsuKrhpacEuaykuav+ZQhcuCkJdiHXnQpBIq
SCoqGgrqLGYaOIksXZq0nEyL+/dc1zkJZY4kyilux64PN73vve533vvOQf+ZcjrfXa8jXYUgOiNFsvhA
SMlnReXAdSACOUMHlfkQ7YB01ziFsprOxCiLjGsysdyCKjxF7fbAGqAoMzQYBZw2bBVtru/OkUzrzP+Z
6BObf73Vx0IDgBDEVyAkBuQw+sPDNMcDif8IBCYJiwC1Obf32EHK8Ae2HW6ZU8z2NVeob+76tBYGzpKt
kJ7B9528g3rQc7JpFvJV3/HVq8os4bgZp1zrxxQBsiBSzeyVQ7qXgrg9+UmKSd7ddZ/StMNRPQQR8FHw
OftAAl4dnLU3rcugOjd4pcaaZ9Z6YtEWekpE6WmHR1MgNDPFg0Mlsq6xbXCqHZZD2pjo+pLQVtDyRUbq
3QCDAHmiMOv/vgHm3WVPX7+Pb3hW4lbP9yN/THp05/0LBMdAXXAxPlcvvy2LzlPzq+wknmJfMm91cwns
d13d3l5/YsBDkgS73p3bOjLF5J+Vy4e0+j5Oqf5rzfZo431ETXfNk2jhaJUeSSXZLtufyYNfCGtKE0cy
VZiuS+X5akAuzoBgOCv8ef0J8NHqKQIHph76ljzR7ngR1jKAWBu3MZbhZkqVWShTxjKb3JebnZqHItqQ
a+FKXrEIza3MbNU6v5e576TAQIIFVZLlItlnAlS5uqlm9X02HuhxQRTSzvw7OIzKgQucponmbqOw2zDM
8Ipri4BKIKTTXYwrE3RwAV5AkWAAT5iP3CLX5bcwhrA5UKxwTNCHieZhqcbgEKn3pXJvWD+j/S2rpnGR
mhlGjQYogLcaX8CC4AIgr/Bd74o2AOeLkw95CSDQJ17y92CMhR+V0BsLuUDwCTns5zQ5fPAXna6f6YG/
8d/HS8AJ30WcSRMxyUAAAAASUVORK5CYII=" alt="Awaiting Checkout" title="Awaiting 
Checkout" id="pagespeed_img_u4nqdNYSjC"/>

and then:

<script type="text/javascript" pagespeed_no_defer>//<![CDATA[
(function(){var a="src";window.pagespeed=window.pagespeed||{};var 
b=window.pagespeed,f=function(){};f.prototype.a=function(g,h){var 
d=document.getElementById(g);if(d){var c=document.getElementById(h);if(c){var 
e=c.previousSibling;e&&(e.src=d.getAttribute(a),c.parentNode.removeChild(c))}}};
f.prototype.inlineImg=f.prototype.a;b.b=function(){b.dedupInlinedImages=new 
f};b.dedupInlinedImagesInit=b.b;})();
pagespeed.dedupInlinedImagesInit();
//]]></script><img alt="Awaiting Checkout" title="Awaiting Checkout"/><script 
type="text/javascript" id="pagespeed_script_1" pagespeed_no_defer>//<![CDATA[
pagespeed.dedupInlinedImages.inlineImg("pagespeed_img_u4nqdNYSjC","pagespeed_scr
ipt_1");
//]]></script>

which is correct.

With dedup_inlined_images on and ModPagespeedRewriteRandomDropPercentage 70 I 
get:

<img src="themes/enuukGreen/img/CheckoutBlank.png.pagespeed.ce.sIfOyqnWd2.png" 
alt="Awaiting Checkout" title="Awaiting Checkout"/>

and then:
<img src="" alt="Awaiting Checkout" title="Awaiting Checkout"/>


It looks as though the problem may be that if the 
ModPagespeedRewriteRandomDropPercentage setting prevents the first image from 
being processed, then with dedup_inlined_images on, the code cannot handle the 
second occurence.

However, it makes no sense as to why this does not work with 
dedup_inlined_images off !

Original comment by rwap.services on 21 Jul 2013 at 8:14

@GoogleCodeExporter
Copy link
Author

I'm able to reproduce the bug described by rwap.services.  It's not due to 
dedup_images so I've created issue 748 to track it.

Original comment by jkar...@google.com on 24 Jul 2013 at 2:39

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant