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

Handle image paths without extension when uploading #39

Open
Starefossen opened this issue Jul 29, 2015 · 7 comments
Open

Handle image paths without extension when uploading #39

Starefossen opened this issue Jul 29, 2015 · 7 comments

Comments

@Starefossen
Copy link
Contributor

Some files does not have an extension (latest version of expressjs/multer for instance) which crates a problem for s3-uploader. We should add the ability to pass inn one of the following:

a) the original file name
b) file extension
b) image mime type

client.upload('/some/file', { mime: "image/jpeg" }, function(err, versions, meta) {
  ...
});
@Starefossen Starefossen changed the title Pass image extension or mime-type when uploading Handle image paths without extension when uploading Jul 29, 2015
@Starefossen Starefossen modified the milestone: v1.1.0 Jul 29, 2015
@oblador
Copy link

oblador commented Aug 21, 2015

Wouldn't it be better to always detect file format instead since mime type/extensions can be wrong? Seems like identify could help with this.

@Starefossen
Copy link
Contributor Author

Good suggestion @oblador, that would definitely be the best option. Would require some more change too I think.

@Starefossen Starefossen modified the milestones: v1.1.0, v1.2.0 Oct 14, 2015
@Starefossen Starefossen modified the milestones: v1.2.0, v2.0.0 Nov 12, 2015
@anthonyringoet
Copy link
Contributor

Just tested this and this does not seem to be problem at first sight.
My test was a jpg, without an extension, used as input for s3-uploader.

@Starefossen
Copy link
Contributor Author

What did the final URL result in for the original and for a resized image look like?

I thought this line assumed that the original image file name has a file extension.

@anthonyringoet
Copy link
Contributor

Well, some of the results have an extension, some do not. So it's a good idea to improve the handling :)

@Starefossen
Copy link
Contributor Author

I just looked into the problem again and remembered that this is not as straight forward as it looked like at first glance since each resized image version may have it's own format (versions[#].format).

We are passing the entire image metadata into resize() which contains the source image format (results.metadata.format). I have created Turistforeningen/node-im-resize#8 which makes use of this to make sure that all resized image versions gets a propper file extension.

We have to do something similar here to make sure that the original image gets a correct file extension as well.

@johnrickman
Copy link

Anyone have a working solution?

@Starefossen Starefossen modified the milestone: v2.0.0 Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants