amp-htmlamp-img

AMP won't let images load


I'm trying to use AMP in my app. I could get my images with:

<img src="{{url('storage/images')}}/{{$post->image}}" alt="{{$post->title}}" class="img-fluid">

but since I added AMP they won't load anymore:

<amp-img src="{{url('storage/images')}}/{{$post->image}}" alt="{{$post->title}}" class="img-fluid"></amp-img>

Any idea what is happening?

UPDATE 1

this is what i added to my site header:

<html amp lang="{{ app()->getLocale() }}">
<!-- amp -->
    <script async src="https://cdn.ampproject.org/v0.js"></script><!-- must besecond child -->
    <link rel="canonical" href="{{url()->current()}}">
    <script type="application/ld+json">
      {
        "@context": "http://schema.org",
        "@type": "NewsArticle",
        "headline": "Open-source framework for publishing content",
        "datePublished": "2015-10-07T12:02:41Z",
        "image": [
          "logo.jpg"
        ]
      }
    </script>
    <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<!-- ./amp -->

here is errors i'm getting in my console:

Powered by AMP ⚡ HTML – Version 1524089272632 http://mynewsite.pp/blog/rtger
viewer-impl.js:1025:11
Error: Layout not supported: container. The element did not specify a layout attribute. Check https://www.ampproject.org/docs/guides/responsive/control_layout and the respective element documentation for details.​​​
log.js:504:16
Error: Layout not supported: container. The element did not specify a layout attribute. Check https://www.ampproject.org/docs/guides/responsive/control_layout and the respective element documentation for details.​​​
log.js:504:16
Error: Layout not supported: container. The element did not specify a layout attribute. Check https://www.ampproject.org/docs/guides/responsive/control_layout and the respective element documentation for details.​​​
log.js:504:16
Error: Layout not supported: container. The element did not specify a layout attribute. Check https://www.ampproject.org/docs/guides/responsive/control_layout and the respective element documentation for details.​​​
log.js:504:16
Blocked loading mixed active content “http://mynewsite.pp/themes/admin/assets/icon/icofont/fonts/icofont.ttf?v=1.0.0-beta”[Learn More]
lounge.bundle.44672f4cc4bed783e5e2f3cb12270277.js:1:1280
Blocked loading mixed active content “http://mynewsite.pp/themes/dup/webfonts/fa-solid-900.woff2”[Learn More]
lounge.bundle.44672f4cc4bed783e5e2f3cb12270277.js:1:1280
Blocked loading mixed active content “http://mynewsite.pp/themes/dup/webfonts/fa-brands-400.woff2”[Learn More]
lounge.bundle.44672f4cc4bed783e5e2f3cb12270277.js:1:1280
Blocked loading mixed active content “http://mynewsite.pp/themes/dup/fonts/Linearicons-Free.woff2?w118d”[Learn More]
lounge.bundle.44672f4cc4bed783e5e2f3cb12270277.js:1:1280
Blocked loading mixed active content “http://mynewsite.pp/themes/dup/webfonts/fa-regular-400.woff2”[Learn More]
lounge.bundle.44672f4cc4bed783e5e2f3cb12270277.js:1:1280
This site appears to use a scroll-linked positioning effect. This may not work well with asynchronous panning; see https://developer.mozilla.org/docs/Mozilla/Performance/ScrollLinkedEffects for further details and to join the discussion on related tools and features!
rtger
Unhandled promise rejection undefined
p13n.min.js:1:41081

Solution

  • make sure width, height are defined on <amp-img> tag otherwise it will not load.