admin管理员组

文章数量:1390677

I have a generated blob url with the following format :

blob:file%3A///2aade.....

I tried to use it directly:

src="blob:file%.... "

and tried it with"blob://" before the url. Which raised a 404 not found error!

what is the correct way to display an image through the blob url?

I have a generated blob url with the following format :

blob:file%3A///2aade.....

I tried to use it directly:

src="blob:file%.... "

and tried it with"blob://" before the url. Which raised a 404 not found error!

what is the correct way to display an image through the blob url?

Share Improve this question edited Feb 8, 2016 at 19:00 Zahema asked Feb 8, 2016 at 18:45 ZahemaZahema 1,4153 gold badges21 silver badges36 bronze badges 4
  • 1 Read more about FileReader – Alon Eitan Commented Feb 8, 2016 at 19:04
  • 1 Maybe you could add some code, show us how you've created this blob, and how you're using it as an image source – adeneo Commented Feb 8, 2016 at 19:05
  • 1 Are you sure the blob currently exists in memory? Remember, they only exist on the current page. – Reda Commented Feb 8, 2016 at 19:06
  • Alon I have been for a while. adeneo it's extracted by zip.js. Reda it's existence wasn't the problem. thank you guys but I figured out what is wrong. I was trying to display the first item in an array of blobs and it happen to be a directory! not even a file. I tried to display the second item and the direct way worked. thanks again. – Zahema Commented Feb 8, 2016 at 19:28
Add a ment  | 

1 Answer 1

Reset to default 5

The correct way is:

src= "blob:file....."

just set the src to the blob url

My mistake was not making sure it was an image blob in the first place!

本文标签: javascriptHow to use blob URL in img tag srcStack Overflow