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

Filetype extraction #19

Closed
ccpandhare opened this issue Mar 16, 2017 · 2 comments
Closed

Filetype extraction #19

ccpandhare opened this issue Mar 16, 2017 · 2 comments
Assignees

Comments

@ccpandhare
Copy link
Collaborator

Some modules might require the filetype.
I hadn't noticed that options.format is undefined, so:

options.format = options.format || "jpg";

always results in options.format to be equal to jpg.
Also, we can't only rely on extension of the file. For example, a jpg file renamed as png would work perfectly fine otherwise, but when we set the src for img, we do:

img.src = 'data:image/' + options.format + ';base64,' + buffer.read().toString();

so this might result in a faulty image.
Should we import the module file-type?

ccpandhare added a commit to ccpandhare/image-sequencer that referenced this issue Mar 16, 2017
As I have mentioned in Issue publiclab#19, `options.format` isn't defined initially. Hence it always gets assigned the value `png`.
This doesn't go well with JPEG images. So I changed it to `jpg`. This does the trick temporarily but then alpha images aren't supported. So could this be implemented till we discuss publiclab#19?
@jywarren
Copy link
Member

jywarren commented Mar 16, 2017 via email

@ccpandhare
Copy link
Collaborator Author

We should think about it.
Actually I was thinking of finding the file-type everytime we export the image as a data URL.
Because everything else is fine but

data:image/wrongformat;base64,...

Can be problematic.

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

2 participants