Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
laclekim
Posts: 41
Registered: ‎02-11-2010
My Device: Bold 9000

Load images in webview from app resources?

Im working on an app that has mulitple images as a core element, and are to be processed inside a webview. 

 

however they will not display inside the webview.

 

My file structure is something like this:

 

assets

       images

             custom-images

       webview

 

Do i have to reference the images in relation to the webview folder, or can I reference them from the root app images folder? if so how?

Developer
RileyGB
Posts: 284
Registered: ‎08-06-2010
My Device: Z10

Re: Load images in webview from app resources?

I think you should be able to access them using the "../images/custom-images/" path.



Follow me on twitter @RileyGB - https://twitter.com/RileyGB
View my BB10 OpenSource projects - https://github.com/RileyGB/BlackBerry10-Samples
Developer
Anand04
Posts: 95
Registered: ‎06-05-2012
My Device: Developer

Re: Load images in webview from app resources?

Hi,

You can use below line to access images from assest folder.

<img src="local:///assets/images/custom-images/webview/myImage.png" alt="My Image" />

Thanks,
Anand Sharma.


Thanks,
Anand Sharma.
Developer
lalthomas
Posts: 24
Registered: ‎05-16-2013
My Device: Developer

Re: Load images in webview from app resources?

[ Edited ]

An easy way to include local images in  Webview  is to use encoded images. You can encode an image here.

Here you needn't have to save your image in your asset folder instead it contained within your hml code itself.