Skip to content

Commit

Permalink
store thumbnails as jpeg, not webp
Browse files Browse the repository at this point in the history
webp has issues
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.ExceptionInInitializerError [in thread "eventLoopGroupProxy-4-1"]
at com.sksamuel.scrimage.webp.WebpWriter.<init>(WebpWriter.java:16)
[...]
  • Loading branch information
sschaeffner committed May 20, 2024
1 parent 53e1f00 commit a9b9280
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
implementation("com.webauthn4j:webauthn4j-core:0.24.0.RELEASE")
implementation("com.sksamuel.scrimage:scrimage-core:4.1.3")
implementation("com.sksamuel.scrimage:scrimage-webp:4.1.3")

testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1")
testFixturesImplementation("io.arrow-kt:arrow-core:1.2.4")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import cloud.fabX.fabXaccess.common.model.CorrelationId
import cloud.fabX.fabXaccess.common.model.Error
import com.sksamuel.scrimage.ImageParseException
import com.sksamuel.scrimage.ImmutableImage
import com.sksamuel.scrimage.webp.WebpWriter
import com.sksamuel.scrimage.nio.JpegWriter
import java.awt.Color

object ThumbnailCreator {
private val writer = WebpWriter.DEFAULT
private val writer = JpegWriter.Default

val default: ByteArray = ImmutableImage.create(600, 600)
.fill(Color.LIGHT_GRAY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import cloud.fabX.fabXaccess.device.model.DeviceRepository
import cloud.fabX.fabXaccess.user.model.AdminFixture
import com.sksamuel.scrimage.ImmutableImage
import com.sksamuel.scrimage.nio.JpegWriter
import com.sksamuel.scrimage.webp.WebpWriter
import isNone
import isSome
import java.awt.Color
Expand Down Expand Up @@ -59,7 +58,7 @@ internal class ChangingThumbnailTest {

val thumbnailData = ImmutableImage.create(600, 600)
.fill(Color.LIGHT_GRAY)
.bytes(WebpWriter.DEFAULT)
.bytes(JpegWriter.Default)

whenever(deviceRepository.getById(deviceId))
.thenReturn(device.right())
Expand Down Expand Up @@ -117,7 +116,7 @@ internal class ChangingThumbnailTest {

val thumbnailData = ImmutableImage.create(600, 600)
.fill(Color.LIGHT_GRAY)
.bytes(WebpWriter.DEFAULT)
.bytes(JpegWriter.Default)

val expectedError = Error.DeviceNotFound("some message", deviceId)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import cloud.fabX.fabXaccess.tool.model.ToolIdFixture
import cloud.fabX.fabXaccess.user.model.AdminFixture
import cloud.fabX.fabXaccess.user.model.UserIdFixture
import com.sksamuel.scrimage.ImmutableImage
import com.sksamuel.scrimage.webp.WebpWriter
import com.sksamuel.scrimage.nio.JpegWriter
import isLeft
import isNone
import isRight
Expand Down Expand Up @@ -373,7 +373,7 @@ internal class DeviceTest {
// given
val thumbnailData = ImmutableImage.create(600, 600)
.fill(Color.GRAY)
.bytes(WebpWriter.DEFAULT)
.bytes(JpegWriter.Default)

val device = DeviceFixture.arbitrary(deviceId)

Expand Down

0 comments on commit a9b9280

Please sign in to comment.