photoviewer
photoviewer copied to clipboard
PhotoViewer crashes with base64 image of 200kb and above
If you try loading an image above 200kb in base64, the app completely crashes. This is repeatable.
This shouldn't happen as that's not a large image.
Is this a known bug or what?
I'm testing with Ionic 2 RC3 and Android 7 on a Nexus 5, 5x and 6.
Same for me, the app completely crashes everytime when calling the method .show giving a base64 string as source image larger than 200kb. Ionic version 2.2.1
Any solution to this yet?
I think it's pretty clear this isn't being actively maintained. My solution was to remove it entirely.
On 4 May 2017 1:19 am, "Joel" [email protected] wrote:
Any solution to this yet?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sarriaroman/photoviewer/issues/49#issuecomment-299070697, or mute the thread https://github.com/notifications/unsubscribe-auth/ANnlXiit9WCmvII60ocmwjJxqGCBu1d1ks5r2Rl9gaJpZM4LOPva .
@daveshirman Found any alternative to this?
I haven't no. How about you?
On 19 May 2017 8:31 am, "Kalamede" [email protected] wrote:
@daveshirman https://github.com/daveshirman Found any alternative to this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sarriaroman/photoviewer/issues/49#issuecomment-302631006, or mute the thread https://github.com/notifications/unsubscribe-auth/ANnlXjjFu-DybCtB2VN-mvbpxeZMIPu2ks5r7UVngaJpZM4LOPva .
@daveshirman I used canvas to resize the image and achieve a size lower than 200kb but images have an almost unacceptable quality to preview, tried to find an alternative unsuccessfully because you actually can view URL given images of 4k+ So I finally lasted them with that almost unacceptable quality (you can watch that photos nicely from a normal mobile phone but from a 10" tablet the image turns very poor) will try something different or a plugin to succesfully compress images without loosing so much quality when I have time
@Kalamede Just had a thought, what if:
- Select an image to view.
- Immediately create a temporary FILE from that image on disk
- Send the URL of that file to the plugin
If you say it can handle urls up to 4k (i.e. plenty big enough), would that work and overcome the kb issue?
This should help:
http://ourcodeworld.com/articles/read/150/how-to-create-an-image-file-from-a-base64-string-on-the-device-with-cordova
@daveshirman That's what I though and it is what I'm going to try when I have time, the bad side is maybe an small loading time added
@Kalamede show a loading spinner. It will be fine and no one will care if it works.
Have you guys tried the temporary file solution? Did it worked?
I gave up on this ages ago as the developer clearly isn't interested in maintaining the code. If you found a solution, please post it here. Thanks.
I have interest, maybe you need to have it too, you can solve it and create a Pull Request. The code is open to be changed, I'm very open to introduce changes made by the community, but I'm messed with work right now to check how to solve the issue. Maybe I will be able to find a solution next week.
One question, did you ever tried to reduce the size of the images you are loading? Big images are not good for the memory that is why is crashing, do you need such a big image? Can you try some kind of middleware to compress the image depending on the device resolution? It's a solution that I normally use to avoid making my apps crash.
@sarriaroman Hi there, nice to see you here. Firstly, thanks for the plugin in the first place. I understand what you're saying but:
-
Users are not generally interested in submitting pull-requests for these plugins. We use them precisely because we don't want to spend the time ourselves coding these things, so we can get on with our apps. That's why we appreciate them so much.
-
Reducing the size of the image is not the answer. The answer is to figure out why it crashes and avoid it. A 200kb image is nothing compared to standard photos of 1MB and upwards.
-
Totally understand that you're busy with work, as are all we, which is why we choose excellent plugins to help us get on with our work too. But this issue was raised 7 months ago and this is the first time you've said anything here, so forgive any of us for feeling disillusioned.
Hopefully you'll be able to help us out. Why don't you set up a donation button or something on your webpage. I'm sure many of us would gladly help you out in return for your time maintaining the plugin code. FREE BEER!
As an temporary [or not] and quick alternative, i've used another module:
- npm install --save ionic-img-viewer
Then I use the imageviewer directive in the img :
- <img class="selected-picture" [src]="base64url" imageViewer>
When you touch the image, it opens the image in a fullscreen view.
This is where I found that solution : https://ionicacademy.com/building-ionic-image-gallery-zoom/
By the way, I wish I could correct the issue with PhotoViewer myself, but I fear I don't have the required knowledge.
same issue for me
use ion-img instead of img works for me