Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

HTML problem img tag

Image tags to local file in html that used to work no longer do. V.1.1.2

ie <img src="myimage.jpeg" width="129" height="129" />
Image file is in the Resources folder.

Just shows broken link tried different references ../myimage.jpeg /myimage.jpeg /Resources/myimage.jpeg

This seems pretty basic to quit working.

— asked March 29th 2010 by Eldon Benz
  • html
  • image
  • img
  • webview

5 Answers

  • Thanks but that actually generates an error.

    [Error] Error loading app://myimage.jpeg

    — answered March 29th 2010 by Eldon Benz
  • I have the same problem. I can make a webview that loads a web page (index.html), but the web page can't seem to reference anything in the Resources directory…

    <img class="logo" src="logo.png"/>

    gives me a broken image in the emulators. src="app://logo.png" causes Titanium desktop to throw an error – "[Error] Error loading app://logo.png". So what's up with that?

    — answered March 30th 2010 by Zach Copley
  • I've finally gotten img references to work in 1.2

    Reference that works for me <img src="app://somefolder/myimage.jpeg" >

    in this somefolder is absolutely required it can be 'Resources' but I just added an 'images' folder inside Resources to put them in.

    ie <img src="app://images/myimage.jpeg" >

    This <img src="app://myimage.jpeg" > will cause the app to crash when it loads the page.

    Haven't tested this on an actual phone yet.

    — answered April 6th 2010 by Eldon Benz
  • Eldon,
    Just to make sure I get it right, app:&#x2F;&#x2F;images&#x2F; resolves to the directory Resources&#x2F;images in the development environement ? In my case, it does not work, image can't be found. I am using Titanium 1.2 targeting Android 1.6.

    Anybody got this method to work on Android ?

    — answered April 7th 2010 by JS -
  • Try something like this and see if it works (assuming your image file is in the Resources folder):

    — answered March 29th 2010 by Dan Giulvezan
    1 Comment
    • What if my image is downloaded and stored in applicationDataDirectory? Is there any way to load that image on webview?

      — commented February 24th 2011 by Manaday Mavani
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.