This repository has been archived by the owner on Apr 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 156
Image dimensions are erroneously supplied to amp-img>img elements #2067
Comments
Hi @westonruter There are some ways to disable these filters:
But these disables the filters for all request, not only for amp pages.
That´s nginx syntax, I don´t know if in apache can be done. |
The easiest approach may be to disable the insert_image_dimensions
<https://www.modpagespeed.com/doc/reference-image-optimize#insert_image_dimensions>
filter:
ModPagespeedDisableFilters insert_image_dimensions
you can also do this in an amp-specific way using fancier config-file
constructs (the syntax of which I have now forgotten :), but it's easiest
if AMP pages are under an "/amp/" subdirectory in the URL path.
…-Josh
On Wed, May 12, 2021 at 2:49 PM Lofesa ***@***.***> wrote:
Hi @westonruter <https://github.com/westonruter>
As far as I know only the filters resize_images and
resize_rendered_image_dimensions can be related to this issue.
Pagespeed by default has a rewrite level core
<https://www.modpagespeed.com/doc/config_filters#level> that enables the
resize_images.
There are some ways to disable these filters:
pagespeed DisableFilters filtera,filterb; (nginx)
ModPagespeedDisableFilters filtera,filterb (apache)
But these disables the filters for all request, not only for amp pages.
Maybe some type of logic can disable these filters only for amp request.
If I remember the AMP Plugin put amp as an arg to the url, so some like
this may work:
if ($args = amp) {
set $disable_filters "resize_images,resize_rendered_image_dimensions";
}
pagespeed DisableFilters "$disable_filters";
That´s nginx syntax, I don´t know if in apache can be done.
pagespeed UrlValuedAttribute amp-img src image
in their config
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2067 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAO2IPKQIGGIEPFNVHCGCADTNLESRANCNFSM44X4ILYA>
.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
A user of the AMP plugin for WordPress reported an issue with images on an AMP page where the server-side rendered
img
in theamp-img
light shadow DOM was getting awidth
andheight
attribute supplied:The
img
inside of anamp-img
getsposition:absolute
and stretches to fill its container element, so thewidth
andheight
are irrelevant. Since the attributes are not expected, they cause AMP validation errors and the AMP base stylesheet inadvertently gives theimg
aposition:relative
styling, which causes the image to be hidden by being positioned outside of the parent's overflow.All this to say, when an
img
is the child ofamp-img
it should be skipped from having itswidth
andheight
supplied.The text was updated successfully, but these errors were encountered: