Closed 4javier closed 2 years ago
These are the changes I made to add the feature: https://github.com/4javier/thumbnailator/tree/NoExt Give them a look and tell me If you want me to issue a pull request.
Cheers.
+1
I needs this feature! It is too tried for me to rename files after I have generated thumbnails! Why not the developer merge your pull request???
I didn't actually submit the pull request because I didn't get any response by the author, tbh. Anyway, activity on this repo is kinda low, so I think that the feature is not considered important enough to test it.
Fine, I should have added your code to the source code in my project, but as I am using maven, I guess I had better add some of code to rename files after thumbnails have generated. However, thanks for you work anyway.
You can use toOutputStream
for that:
try (OutputStream os = new FileOutputStream(new File("myfile"))) {
Thumbnails.of(input).size(210, 160).toOutputStream(os);
}
You can use
toOutputStream
for that:try (OutputStream os = new FileOutputStream(new File("myfile"))) { Thumbnails.of(input).size(210, 160).toOutputStream(os); }
What if I pass in a folder?
This ticket brings up good points, so I'm considering for a later version (such as 0.5.0) where breaking changes wouldn't impact existing consumers of this library.
Superseding with #186.
Expected behavior
Let the user choose if destination thumbnail name should got an extension or not.
Actual behavior
Extension for output get selected from original image format type if this one doesn't match with the passed extension. (Why??? If it matches, it gets used. If it doesn't matches, it gets used anyway because they're identical. Why not use it directly, ignoring the supplied extension? But that's not the point here...)
Solution
On server, file extensions are quite useless. And they can be tricky to manipulate. I was thinking of a flag NO_EXT to make the system not appending an extension at all to output file. I forked your project and worked out a couple options:
The second one is my favorite approach. Please, tell me what you think about that.