-
Notifications
You must be signed in to change notification settings - Fork 789
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
Option to create thumbnail without extension #150
Comments
These are the changes I made to add the feature: 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. |
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 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. |
기존 Thumbnail 라이브러리에서 썸네일을 생성할때, 확장자가 없어도 자동으로 생성하는지 몰랐었네요. reference issue : coobird/thumbnailator#150
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:
add a new const NO_EXT to Rename class, that strips out the extension from the file.
Drawback is that all the work done by FileImageSink to appending it, would be wasted.
adding NO_EXT as Builder property (I got to study a bit this part of your code. It's kinda obscure to me...), and check for its value in FileImageSinkValue.write(BufferedImage) before all the other ones already present, and if true calling simply new File(destinationFile.getAbsolutePath())
The second one is my favorite approach.
Please, tell me what you think about that.
The text was updated successfully, but these errors were encountered: