Verified Commit a04a7b94 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

use correct path for poster image thumbnails

parent dd623f13
Pipeline #43112 passed with stages
in 6 minutes and 2 seconds
......@@ -44,12 +44,15 @@ trait FileUtils {
id => s"${normalize(rootPath)}/$id-intro.mp3"
val imageFileRootPath: (String, MimeType) => String =
(id, mimeType) => imageFilePath(rootPath, id, mimeType)
(id, mimeType) => imageFilePath(rootPath, id, mimeType, x => x)
val cachedImageFilePath: (String, MimeType) => String =
(id, mimeType) => imageFilePath(cachedImagePath, id, mimeType)
val imageThumbnailFilePath: (String, MimeType) => String =
(id, mimeType) => imageFilePath(cachedImagePath, id, mimeType, x => x)
private val imageFilePath: (String, String, MimeType) => String =
(path, id, mimeType) => s"${normalize(path)}/$id.${getFileTypeExtension(mimeType).get}"
val posterImageThumbnailFilePath: (String, MimeType) => String =
(id, mimeType) => imageFilePath(cachedImagePath, id, mimeType, _.replace("/derived", "-poster"))
private val imageFilePath: (String, String, MimeType, String => String) => String =
(path, id, mimeType, idTransform) => s"${normalize(path)}/${idTransform(id)}.${getFileTypeExtension(mimeType).get}"
......@@ -94,20 +94,21 @@ class RecordProcessor(fileHandler: DisseminationCopyHandler,
createOutcome(res, id, DigitalObject, destFile)
case mT: ImageFile if resource == DigitalObject =>
val destFile = imageFileRootPath(id, mT)
createImageAndThumbnail(id, data, destFile, mT, DigitalObject)
createImageAndThumbnail(id, data, destFile, mT, DigitalObject, imageThumbnailFilePath)
case mT: ImageFile if resource == VideoThumbnail =>
val destFile = videoPosterPath(id, mT)
createImageAndThumbnail(id, data, destFile, mT, VideoThumbnail)
createImageAndThumbnail(id, data, destFile, mT, VideoThumbnail, posterImageThumbnailFilePath)
private def createImageAndThumbnail(id: String,
data: ByteArrayOutputStream,
destImageFile: String,
mimeType: MimeType,
memobaseResource: MemobaseResource): List[ProcessOutcome] = {
memobaseResource: MemobaseResource,
thumbnailFilePathFun: (String, MimeType) => String): List[ProcessOutcome] = {
val resMediaFile = fileHandler.createImageCopy(data, destImageFile, mimeType)
val outcomeMediaFile = createOutcome(resMediaFile, id, memobaseResource, destImageFile)
val destPreviewFile = cachedImageFilePath(id, mimeType)
val destPreviewFile = thumbnailFilePathFun(id, mimeType)
val (width, height) = getThumbnailDimensions
val resThumbnail = fileHandler.createImageThumbnail(destImageFile, destPreviewFile, width, height)
val outcomeThumbnail = createOutcome(resThumbnail, id, ImageThumbnail, destPreviewFile)
Supports Markdown
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