vue-material.js?ec92:6 Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0.

Created on 7 Feb 2017  路  6Comments  路  Source: vuematerial/vue-material

my code

  <swiper :options="swiperOption" ref="mySwiperA">
          <swiper-slide v-for="story of topStories">
              <md-card>
                <md-card-media-cover md-text-scrim>
                  <md-card-media md-ratio="16:9">
                    <img :src="story.image | imageUrlPrefix">
                  </md-card-media>
                  <md-card-area>
                    <md-card-header>
                      <div class="md-title">{{ story.title }}</div>
                    </md-card-header>
                  </md-card-area>
                </md-card-media-cover>
              </md-card>
          </swiper-slide>
          <div class="swiper-pagination"  slot="pagination"></div>
        </swiper>

I dont understand why it happened,and swiper did not render.

Most helpful comment

The issue has fixed when I romove md-ratio paramete from md-card-media.

All 6 comments

This is because your image is not on the same domain. The getImageData method rely on a Canvas solution, and, for security, the browser don't allow reading images from external sources. I will fix that. Related to #424

I am loading an image from my src/assets/images folder, yet I still get the same error. This is so frustrating.

Same error if i testing on localhost, Its fix on the way?

Same error with an image from src/assets

Same error, just when trying to put the card with image inside a md-gutter

However, Image and card are working outside the md-gutter layout

any idea? @marcosmoura

The issue has fixed when I romove md-ratio paramete from md-card-media.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreujuanc picture andreujuanc  路  3Comments

xinzhanguo picture xinzhanguo  路  3Comments

lee-frank picture lee-frank  路  3Comments

sergey-koretsky picture sergey-koretsky  路  3Comments

tridcatij picture tridcatij  路  3Comments