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

unsupported file type: undefined (file: undefined) #73

Closed
digitalmc opened this issue Apr 28, 2016 · 2 comments
Closed

unsupported file type: undefined (file: undefined) #73

digitalmc opened this issue Apr 28, 2016 · 2 comments

Comments

@digitalmc
Copy link

I get the following error when I try to get the image size of select images:

unsupported file type: undefined (file: undefined)

Below are a list of two of the image in question:

Most other images work. To note these are both from wordpress sites. The images were saved out of Photoshop (Save for Web & Devices) which means they were properly compressed and then uploaded to Wordpress.

Any help appreciated!

@anhreg
Copy link

anhreg commented May 13, 2017

After hours debug, checking the image-resize code and googling around. I found this possibly is the reason:

The server may not support chunk download. Nodejs doesn't recognize this and thinks that the downloading has finished normally, then it triggers the .on('end') event. Thus, the buffer you get is only a few bytes. It doesn't meets the requirement that the jpg TypeMap needs (4096). It will consider this unsupported type. https://github.com/image-size/image-size/blob/master/lib/types/jpg.js

I have tried with your image links. It seems that we have the same issue. Your first image chunk size is 438 bytes. Clearly not enough for image-size to work properly.

Refs: nodejs/node-v0.x-archive#6143 where SteveJobzniak listed out possible causes that the server closes connection in the middle.

I'm looking for walkarounds.

@netroy
Copy link
Member

netroy commented May 15, 2017

I downloaded the files locally, the ran image-size against them, & got the correct dimensions .. So, it's possible that @anhreg said applied to @digitalmc as well..

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

3 participants