question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to load images

See original GitHub issue

hello

i’m trying to use vue-html2canvas but for some reason it s not able to load images

note: i have this as options

const options = {
        type: 'dataURL',
        backgroundColor: 'red',
        allowTaint: true,
        width: '256px',
        height: '512px',
        imageTimeout: 0,

      }

Console output:

0ms html2canvas: html2canvas $npm_package_version
1848ms html2canvas: Document cloned, using computed rendering
1849ms html2canvas: Starting node parsing
1854ms html2canvas: Added image https://www.lesroyaumes.com/images/personnages_midas/hommes/corps/corps_p0_@1X.webp
1856ms html2canvas: Added image https://lesroyaumes.cdn.oxv.fr/images/personnages_midas/hommes/corps/visage_0_p0_@1X.webp
1860ms html2canvas: Added image 
1892ms html2canvas: Finished parsing node tree
1928ms html2canvas: Unable to load image Event {isTrusted: true, type: "error", target: img, currentTarget: img, eventPhase: 2, …}bubbles: falsecancelBubble: falsecancelable: falsecomposed: falsecurrentTarget: nulldefaultPrevented: falseeventPhase: 0isTrusted: truepath: [img]returnValue: truesrcElement: nulltarget: nulltimeStamp: 20608.655type: "error"__proto__: Event
2038ms html2canvas: Finished loading 3 images (3) [img, img, null]
2039ms html2canvas: Starting renderer
2041ms html2canvas: Canvas renderer initialized (541x0 at 1708.4635009765625,116.97915649414062) with scale 0.6000000238418579
2054ms html2canvas: Render completed

can you please take a look? source code

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
iyngacommented, Apr 25, 2021

Where do you put your setTimeout() ?

Actually, we don’t really need to put it inside a setTimeout(). It just depends on your use case.

This is what I did to make it work (esp loading images using URLs):

<div>
  <img src="https://somesecuredwebsite.com/images/1.png" crossorigin="anonymous" />
</div>

take note of the crossorigin=“anonymous” above…

const base64Image = await this.$html2canvas(el, { type: 'dataURL', useCORS: true, logging: false })
console.log(base64Image)

It is not working. I am getting the same issue.

1reaction
arnoldlabastillacommented, Oct 1, 2019

Where do you put your setTimeout() ?

Actually, we don’t really need to put it inside a setTimeout(). It just depends on your use case.

This is what I did to make it work (esp loading images using URLs):

<div>
  <img src="https://somesecuredwebsite.com/images/1.png" crossorigin="anonymous" />
</div>

take note of the crossorigin=“anonymous” above…

const base64Image = await this.$html2canvas(el, { type: 'dataURL', useCORS: true, logging: false })
console.log(base64Image)
Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Ways to Fix Google Chrome Not Loading Images - MakeUseOf
7 Ways to Fix Google Chrome Not Loading Images · 1. Update Google Chrome · 2. Go Incognito · 3. Check Chrome's Site...
Read more >
9 Fixes When Images Not Loading in Chrome - Help Desk Geek
9 Fixes When Images Not Loading in Chrome · 1. Try a Different Browser · 2. Check the Show All Images Option ·...
Read more >
5 Reasons Why Your Images Won't Load | SiteUptime Blog
1. Your Photos Are Too Large · 2. The Image Doesn't Exist · 3. Wrong Filename and Extension · 4. Local File Path...
Read more >
Troubleshoot issues with Google Images - Google Search Help
Step 1: Try private browsing mode · Step 2: Clear your browser's cache & cookies · Step 3: Turn off any toolbars &...
Read more >
7 Reasons Why Images Are Not Loading on Your Website
7 Reasons Why Images Are Not Loading on Your Website · 1. Incorrect File Paths · 2. Files Names Misspelled · 3. Wrong...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found