Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a valid image url from ArrayBuffer #12

Open
Zinggi opened this issue Apr 12, 2014 · 8 comments
Open

How to create a valid image url from ArrayBuffer #12

Zinggi opened this issue Apr 12, 2014 · 8 comments

Comments

@Zinggi
Copy link

Zinggi commented Apr 12, 2014

Thanks for you wonderful library, I've already tested this and this before, but yours is way faster.

I've got a question about how to use the returned image data. I'm currently doing it that way:

var arrayBufferView = new Uint8Array(tags.v2.image.data);
tags.v2.image.mime = tags.v2.image.mime || 'image/jpeg';
var blob = new Blob([arrayBufferView], {type: tags.v2.image.mime});
var urlCreator = window.URL || window.webkitURL;
var imageUrl = urlCreator.createObjectURL(blob);

This works sometimes, however most of the time it fails. Sometimes it just doesn't create a valid file URL, most of the time it creates only parts of the picture and rarely it works perfectly:

All of these mp3 covers are shown correctly in my windows explorer.
The ones that have a nice placeholder image don't have a tags.v2.image attribute. (which is alright, better have nothing then something wrong...)
The last one somehow created an invalid URL, the others show only a part of the image.
Interestingly the Beatles one doesn't show up in my explorer, but your library parses it correctly.

Am I doing this wrong?

@Zinggi
Copy link
Author

Zinggi commented Apr 12, 2014

That's very interesting.
I haven't found a single file that works perfectly and also shows up in my explorer.

Same the other way around:
All that work perfectly don't show up in my explorer at all.

This might indicate a windows (probably windows media player) only bug. My guess is that windows media player somehow screws with those tags to make it good for windows explorer, but your parser has problems with those files.

@Zinggi
Copy link
Author

Zinggi commented Apr 16, 2014

I'll be using this library for now, even though it's pretty slow.
Thanks nevertheless.

@43081j
Copy link
Owner

43081j commented Apr 17, 2014

Sorry about this, I am very short of time so didn't get chance to come on here yet. I'll check this and the other issues out tomorrow :)

@beamercola
Copy link

Still seeing this issue - is there a chance this will get fixed?

@sumitridhal
Copy link

I've the same issue..

@CovorSorin
Copy link

I'm having the same issue.

@aldorr
Copy link

aldorr commented Sep 11, 2019

Hi Zinggi,
Was just implementing your library, and thought I was just messing up the ArrayBuffer conversion to base64 or blob. But then stumbled upon this post. Is there any chance of reviving this repository. I'm trying to make some sense of the problem, but haven't come up with anything yet.
Thanks

@vowave
Copy link

vowave commented Sep 13, 2019

To anyone else having this problem you can use the following gist to convert array buffer data to base64 image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants