Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Removed snapshot build and enhanced image loading in code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed Nov 23, 2023
1 parent a9b9db3 commit 6d0b9d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ jobs:
username: ziedelth
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push snapshot
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/master'
with:
context: .
push: true
tags: registry.ziedelth.fr:5000/jais-api:snapshot

- name: Build and push production
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/stable'
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/fr/ziedelth/utils/ImageCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ object ImageCache {

try {
bytes = saveImage(url).readBytes()
if (bytes.isEmpty()) throw Exception("Failed to load image")

val webp = encodeToWebP(bytes)
cache[uuid] = Image(url, webp, "webp") to true
} catch (e: Exception) {
Expand All @@ -50,7 +52,7 @@ object ImageCache {
if (Imgcodecs.imencode(".webp", matImage, output, parameters)) {
return output.toArray()
} else {
error("Failed to encode the image as webp")
throw Exception("Failed to encode image to WebP")
}
}

Expand Down

0 comments on commit 6d0b9d5

Please sign in to comment.