You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior:
I am using the show function of the Photoviewer plugin in my Ionic app with a Base64 string (e.g., "data:image/jpeg;base64,/9j/4AAQSkZJ.....TY3OD=="). However, this results in an error:
I've been able to resolve this issue in 'one' mode but, due to my limited experience with Java, I haven't been able to create a PR to address the issue fully. Please refer to the Related Code section for more details.
Expected behavior: The plugin should support Base64 strings as described in the README.
Steps to reproduce: N/A
Related code:
Here is my usage in my Ionic app, which very simple
The issue seems to be related to this file: ImageFragment.kt. Below is a snippet of the code where the issue occurs:
val mImageToBeLoaded = ImageToBeLoaded()
val toBeLoaded = image.url?.let { mImageToBeLoaded.getToBeLoaded(it) }
if (toBeLoaded is String) {
// load image from url
val lazyHeaders = LazyHeaders.Builder()
for (key in customHeaders.keys()) {
customHeaders.getString(key)?.let { lazyHeaders.addHeader(key, it) }
}
val glideUrl = GlideUrl(toBeLoaded, lazyHeaders.build())
GlideApp.with(appContext)
.asBitmap()
.load(glideUrl)
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(ivTouchImage)
}
In cases when toBeLoaded returns a Base64 string, the current implementation doesn't handle it properly.
I added the following check to address this, and it worked as expected.
I believe this issue is related to this commit, which introduced support for custom headers but didn't account for Base64 strings.
if (toBeLoaded is String) {
if (toBeLoaded.contains("base64")) {
GlideApp.with(appContext)
.asBitmap()
.load(toBeLoaded)
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(ivTouchImage)
}
else {
// load image from url
val lazyHeaders = LazyHeaders.Builder()
for (key in customHeaders.keys()) {
customHeaders.getString(key)?.let { lazyHeaders.addHeader(key, it) }
}
val glideUrl = GlideUrl(toBeLoaded, lazyHeaders.build())
GlideApp.with(appContext)
.asBitmap()
.load(glideUrl)
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(ivTouchImage)
}
}
Other information: This is my first time creating an issue, so please feel free to correct me if I’ve made any mistakes.
The text was updated successfully, but these errors were encountered:
Plugin version: On the latest version 4.0.0
Platform(s): Android
Current behavior:
I am using the show function of the Photoviewer plugin in my Ionic app with a Base64 string (e.g., "data:image/jpeg;base64,/9j/4AAQSkZJ.....TY3OD=="). However, this results in an error:
I've been able to resolve this issue in 'one' mode but, due to my limited experience with Java, I haven't been able to create a PR to address the issue fully. Please refer to the
Related Code
section for more details.Expected behavior: The plugin should support Base64 strings as described in the README.
Steps to reproduce: N/A
Related code:
Here is my usage in my Ionic app, which very simple
The issue seems to be related to this file: ImageFragment.kt. Below is a snippet of the code where the issue occurs:
In cases when
toBeLoaded
returns a Base64 string, the current implementation doesn't handle it properly.I added the following check to address this, and it worked as expected.
I believe this issue is related to this commit, which introduced support for custom headers but didn't account for Base64 strings.
Other information: This is my first time creating an issue, so please feel free to correct me if I’ve made any mistakes.
The text was updated successfully, but these errors were encountered: