ionic-image-loader icon indicating copy to clipboard operation
ionic-image-loader copied to clipboard

[Bug] Unable to load SVG image

Open grumpy-huskie opened this issue 8 years ago • 6 comments

Hi I am trying to load SVG image but it always shows a blank square, is it becuase it does not support SVG?

grumpy-huskie avatar Aug 24 '17 03:08 grumpy-huskie

I haven't tried SVGs... this can be caused by the file extension. This module saves images in the local storage without extensions, and this causes the browser to load it as a normal image.

If you use the base64 option for these images, it might work. I will update the module and include file extensions in the local storage.

ihadeed avatar Sep 02 '17 02:09 ihadeed

Ah yes, I have the same issue ;) Remote png works fine but when I switched to SVG it does not work:
https://forum.ionicframework.com/t/svg-images-served-from-remote-serve-not-rendering-in-android-native-build/111607

I'll do a workaround and keep an eye on this, thanks

rodneyjoyce avatar Nov 09 '17 17:11 rodneyjoyce

I'm having the same issue. I hope the module supports SVGs asap. Also, cannot upgrade from 4.2.1 to the latest version due to #131 bug.

jeffminsungkim avatar Mar 01 '18 11:03 jeffminsungkim

Also experiencing the same problem... did anyone find a workaround for this? (other than changing to a JPEG/PNG?)

jaybloke avatar Mar 19 '18 04:03 jaybloke

imageLoaderConfig.setFileNameCachedWithExtension(true); solved my issue that svg files cannot be loaded. Set it to true will keep the file extension and it works fine for me.

jacywang avatar Aug 24 '18 17:08 jacywang

@jacywang imageLoaderConfig.setFileNameCachedWithExtension(true); is helpful to solve the svg issue for extension. but, the images are not rendered.upon inspecting the src has the value as local file url .can anyone mention a solution for this. File url:

file:///data/user/0//cache/image-loader-cache/1510130930.svg

Sudhir22sep avatar Sep 05 '18 04:09 Sudhir22sep