Skip to content

Commit

Permalink
fix issues with reading thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy1612 committed Sep 7, 2022
1 parent 9fb11b3 commit f2b70ca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/com/idrsolutions/JDeliImageReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ private void getByteArray() {
*/
@Override
public boolean hasThumbnails(int index) throws IOException {
if (currentImageIndex == index && readerSupportsThumbnails()) {
if (currentImageIndex != index) {
currentImageIndex = index;
}
if (readerSupportsThumbnails()) {
try {
return JDeli.readEmbeddedThumbnail(bytes) != null;
} catch (Exception e) {
Expand All @@ -301,7 +304,7 @@ public boolean hasThumbnails(int index) throws IOException {
*/
@Override
public BufferedImage readThumbnail(final int imageIndex, final int thumbnailIndex) throws IOException {
if (readerSupportsThumbnails()) {
if (!readerSupportsThumbnails()) {
tn = delegate.readThumbnail(imageIndex, thumbnailIndex);
} else if (currentThumbnailIndex != thumbnailIndex && currentImageIndex != imageIndex && tn == null) {
currentThumbnailIndex = thumbnailIndex;
Expand Down

0 comments on commit f2b70ca

Please sign in to comment.