Display an image from SD card

Hi,

How can I display an image from SD card on ET1? I put an <img> tag on .erb file with a valid filename file:///sdcard/image1.jpg but I get the error "Not allowed to load local resource: file:///sdcard/image1.jpg"

Thanks

Robert Galvin
Get rid of "sdcard" and wrap

Get rid of "sdcard" and wrap it in a url(' ');

<img src="url('file:///image1.jpg')"

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adel Sari
Hollo Rob, thanks for your

Hollo Rob, thanks for your reply,

Unfortunately your idea didn't work for me.

I have added the sdcard capability to my build.yml file, and i tried this links, but all generated errors:

  <img src="Folder/image1.jpg" ></img>                 Error: the file was not found

   <img src="/Folder/image1.jpg" ></img>                Error: the file was not found

   <img src="file:///Folder/image1.jpg" ></img>        Error: Not allowed to load local resource

  <img src="url(file:///Folder/image1.jpg)" ></img>  Error: Action 'url(file:' does not exist in controller or has private access

  <img src="url('file:///Folder/image1.jpg')" ></img> Error: Action 'url(file:' does not exist in controller or has private access

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bhakta Ranjan S...
Hello,Kindly use File API

Hello,

Kindly use File API (http://docs.rhomobile.com/rhodesapi/file-api) to access content from SD card.

I think you need to use code like below

fileName = File.join('/sdcard/Android/data/', 'image1.jpg')

File.open(fileName)

Thanks

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments