node-imager icon indicating copy to clipboard operation
node-imager copied to clipboard

Better file type checking

Open MarZab opened this issue 12 years ago • 2 comments

Uploading a image with the extension .jpeg but that is actually a gif makes imagemagic puke.

See enclosed gif.

qkq1k

MarZab avatar Feb 20 '14 22:02 MarZab

@MarZab thanks for this issue! I am planning to use https://github.com/mscdex/mmmagic which is able to detect mime type by reading the file. Waiting for mmmagic/issues/16 to be resolved...

I have re-written imager, if you want to give a try here is a pre-release https://github.com/imagerjs/imager/releases/tag/1.0.0-alpha1

madhums avatar Sep 22 '14 17:09 madhums

no file header crashes node

type: typeof(file) == 'string' ? mime.lookup(file) : file.type || file.mimetype || file.headers['content-type'],

should be

    type: typeof(file) == 'string' ? mime.lookup(file) : file.type || file.mimetype || (file.headers && file.headers['content-type']),

fyyyyy avatar Jan 30 '15 20:01 fyyyyy