Search code examples
wordpressimageamp-html

Images not showing on Amp version


Images work on normal page but the amp-version the images doesn't show.

here is a HTML code of a picture, I use WordPress and upload via media library and insert:

<a href="https://www.amazon.com/Stanley-Screwdriver/dp/B0014KMDZ0/ref=as_li_ss_tl?ie=UTF8&amp;qid=1482529941&amp;sr=8-1&amp;keywords=Pocket+Screwdriver&amp;linkCode=ll1&amp;tag=rasrf1-20&amp;linkId=a7cefc1156af5144695cf921ad1241c1"><img class="aligncenter wp-image-312" src="http://mysiteexample.com/wp-content/uploads/2016/11/review-1024x768.jpg" alt="Stanley Review" width="256" height="192" /></a>

"

Is there a script I need to insert or something for it to work on amp?

Thanks for your time, I appreciate it.


Solution

  • Use amp-img instead of img for the amp version of your site.

    <a href="#">
        <amp-img src="http://mysiteexample.com/wp-content/uploads/2016/11/review-1024x768.jpg" width="256" height="192" layout="responsive" alt="Stanley Review"></amp-img>
    </a>