Class ThumbnailService
java.lang.Object
engineering.everest.starterkit.media.thumbnails.ThumbnailService
Service layer for thumbnails.
The maximum size of either height or width of a generated thumbnail can be configured using the
application.media.thumbnail.max.dimension.pixels property.
-
Constructor Summary
ConstructorsConstructorDescriptionThumbnailService(int maxDimensionPixels, engineering.everest.starterkit.filestorage.FileService fileService, ThumbnailMappingRepository thumbnailMappingRepository) -
Method Summary
Modifier and TypeMethodDescriptionvoidClear all thumbnail mappings.streamThumbnailForOriginalFile(UUID fileId, int width, int height) Generates a thumbnail for a file stored by one of the deduplicating filestores.
-
Constructor Details
-
ThumbnailService
@Autowired public ThumbnailService(@Value("${application.media.thumbnail.max.dimension.pixels:2400}") int maxDimensionPixels, engineering.everest.starterkit.filestorage.FileService fileService, ThumbnailMappingRepository thumbnailMappingRepository)
-
-
Method Details
-
streamThumbnailForOriginalFile
public InputStream streamThumbnailForOriginalFile(UUID fileId, int width, int height) throws IOException Generates a thumbnail for a file stored by one of the deduplicating filestores.Generated thumbnails are cached on the ephemeral file store. Callers are responsible for closing the returned input stream.
- Parameters:
fileId- UUID returned by thePermanentDeduplicatingFileStoreor theEphemeralDefuplicatingFileStorewidth- desired thumbnail widthheight- desried thumbnail height- Returns:
- an input stream to retrieve a thumbnail.
- Throws:
IOException- if the original file cannot be readIllegalArgumentException- if the thumbnail dimensions are impossibly small or larger than the maximum supported.
-
getAllThumbnailFileIds
-
deleteAllThumbnailMappings
public void deleteAllThumbnailMappings()Clear all thumbnail mappings.
-