Commit e25f6d2c authored by Matija Obreza's avatar Matija Obreza

Thumbs: bugfixes

parent 82e8b490
Pipeline #10127 passed with stage
in 1 minute and 29 seconds
......@@ -20,7 +20,6 @@ import java.io.IOException;
import org.genesys.filerepository.model.RepositoryImage;
// TODO: Auto-generated Javadoc
/**
* The Interface ThumbnailGenerator.
*/
......
......@@ -271,16 +271,17 @@ public class ImageGalleryServiceImpl implements ImageGalleryService {
private void generateThumbnails(final RepositoryImage repositoryImage) {
try {
final byte[][] cache = new byte[1][];
final byte[][] cache = new byte[thumbnailSizes.length][];
for (int i = thumbnailSizes.length - 1; i >= 0; i--) {
cache[0] = ensureThumbnail(thumbnailSizes[i], thumbnailSizes[i], repositoryImage, () -> {
if (cache[0] != null) {
final int cachePos = thumbnailSizes.length - i - 1;
cache[cachePos] = ensureThumbnail(thumbnailSizes[i], thumbnailSizes[i], repositoryImage, () -> {
if (cache[cachePos] != null) {
LOG.debug("Using cached image bytes for {}", repositoryImage.getStoragePath());
return cache[0];
return cache[cachePos];
} else {
LOG.info("Must load image bytes for {}", repositoryImage.getStoragePath());
return cache[0] = bytesStorageService.get(repositoryImage.storagePath());
return cache[cachePos] = bytesStorageService.get(repositoryImage.storagePath());
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment