Closed GoogleCodeExporter closed 8 years ago
Thank you for filing this issue and bringing it to my attention.
I appreciate all the details you've provided.
This is indeed a quite plausible scenario which can cause problems.
Although I have not tried to reproduce this issue, I can imagine that this
problem will occur.
Therefore, at the very least, Thumbnailator should be changed to not die when
it encounters a directory.
How to Handle Nested Folders
----------------------------
I'm leaning toward *not* performing a resize of the nested folders by default,
with the reason being, how to handle the file names and folder structure of the
thumbnails being output.
I can imaging the following scenario:
root/
image.jpg
drawing.png
folder/
photo.jpg
drawing.png
Now, the question will be how the thumbnails should be laid out.
A few options can be:
1. Thumbnails of all files, including nested ones, will be placed in the same folder.
=> Problem being that `root/drawing.png` and `root/folder/drawing.png` will have a file name collision.
2. Thumbnails of all files, including nested ones, will be placed in the original folder.
=> This may clash with Issue 51, as what should happen if a separate directory is set as the output directory?
Also, should be nested directories be created in this case? Should be directory names be the same?
As handling nested directories can become very complex, I think it should be a
completely separate issue from graceful handling of input directories which
contains other directories.
Handling all scenarios can add complexity and lead to many edge cases (which
can lead to many bugs), I'd rather try to keep things simple.
I'd be interested in how you think. :)
Thank you for bringing this issue to my attention!
Original comment by coobird...@gmail.com
on 21 Dec 2013 at 10:58
On second thought, I was getting this all wrong with the previous comment.
First, since the `Thumbnails.of` accepts a list of `File`s, if it is given a
directory, its only choices will be:
a. Reject the non-file input and stop, which is the current behavior, or
b. Start processing nested directories recursively.
However, considering the Thumbnailator API dictates that it should get "image
files"[1], handing it a directory is a not a valid use of the
`Thumbnails.of(File...)` method -- a directory is not an image file.
Therefore, I'm not going to change this behavior, as it is by design.
That said, there probably are use cases for wanting to recursively process
directories with images, I'm going to make a separate ticket as a Request for
Enhancement.
Thank you for filing this issue, as it's indeed an issue that I can expect
people to encounter through normal use of Thumbnailator.
[1]:
http://thumbnailator.googlecode.com/hg/javadoc/net/coobird/thumbnailator/Thumbna
ils.html#of(java.io.File...)
Original comment by coobird...@gmail.com
on 21 Dec 2013 at 3:33
I've created Issue 64, which is a feature request for recursively processing
nested directories.
Original comment by coobird...@gmail.com
on 21 Dec 2013 at 3:37
Thanks for responding promptly. Actually you're right that it isn't a bug,
however a much needed enhancement for sure. I've the exact use case which is
referred in your 1st comment. Since I only had the .jpg files in the
directories, I was able to get through using Java 7 File tree walker api [1].
So, thanks for creating the ticket for enhancement and for providing the great
library.
[1]:http://docs.oracle.com/javase/tutorial/essential/io/walk.html
Original comment by dhawansh...@gmail.com
on 22 Dec 2013 at 10:44
Thank you for the heads up on the file tree walking API of Java 7 -- I haven't
been up-to-speed with the new features of Java 7, so I'll try to keep it in
mind when I have a need for it!
I'm glad you found Thumbnailator useful :)
Original comment by coobird...@gmail.com
on 24 Dec 2013 at 3:41
Original issue reported on code.google.com by
dhawansh...@gmail.com
on 21 Dec 2013 at 3:19