From 07c4cb6a0fef46ecc2f3e82cd1148d03bd318716 Mon Sep 17 00:00:00 2001 From: IC Rainbow Date: Sun, 15 Dec 2024 21:01:10 +0200 Subject: [PATCH] Fix resize in android --- .../kotlin/chat/simplex/common/platform/Images.android.kt | 4 ++-- .../kotlin/chat/simplex/common/platform/Images.desktop.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/platform/Images.android.kt b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/platform/Images.android.kt index 1d74668b67..a94675eec2 100644 --- a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/platform/Images.android.kt +++ b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/platform/Images.android.kt @@ -34,7 +34,7 @@ actual fun base64ToBitmap(base64ImageString: String): ImageBitmap { val imageBytes = Base64.decode(imageString, Base64.NO_WRAP) BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size).asImageBitmap() } catch (e: Exception) { - Log.e(TAG, "base64ToBitmap error: $e") + Log.e(TAG, "base64ToBitmap error: $e for input '$base64ImageString' -> '$imageString'") errorBitmap.asImageBitmap() } } @@ -46,7 +46,7 @@ actual fun resizeImageToStrSize(image: ImageBitmap, maxDataSize: Long): String { compressImageData(image, true).writeTo(output) output.flush() output.close() - var str = chatResizeImageToStrSize(tmpFileName, maxDataSize) + var str = chatResizeImageToStrSize(tmpFile.absolutePath, maxDataSize) removeFile(tmpFileName) return str } diff --git a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Images.desktop.kt b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Images.desktop.kt index ba844995a5..6a69bd06ef 100644 --- a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Images.desktop.kt +++ b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Images.desktop.kt @@ -29,7 +29,7 @@ actual fun base64ToBitmap(base64ImageString: String): ImageBitmap { return try { ImageIO.read(ByteArrayInputStream(Base64.getMimeDecoder().decode(imageString))).toComposeImageBitmap() } catch (e: Exception) { // ByteArrayInputStream returns null - Log.e(TAG, "base64ToBitmap error: $e for \"$base64ImageString\"") + Log.e(TAG, "base64ToBitmap error: $e for input '$base64ImageString' -> '$imageString'") errorBitmap() } }