Re: [PhoneGap] image file in www folder not loading in ios cordova project

7,118 views
Skip to first unread message

Kerri Shotts

unread,
Oct 29, 2012, 2:03:52 AM10/29/12
to phon...@googlegroups.com
You're referencing logo.png absolutely. Instead, do one of the following:

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

Now whether or not "/" should reference the root of the file system or the root of the app's www is up for debate. I just avoid the issue, and always use a relative reference.

_________________________________________
~Kerri Shotts, photoKandy Studios LLC
   Wanna be our neighbor? Our Facebook page & Twitter feed.

On Sunday, October 28, 2012 at 2:18 PM, Nick Manos wrote:

In our ios cordova/phonegap project we are trying to load an image in an img element. Using Cordova 2.1.0. The resource is located in the www folder and being bundled into the app but the reference is wrong and the image is not loaded. The HTML code looks like this where we are including an img:

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

If I use web inspector and click on the resource, the full path is:

file:///images/logo.png

In a new Cordova project, the full path for a similar resource is:

file:///Users/username/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/755C7D95-609C-4C62-8F42-893FD79EDA87/HelloCordova.app/www/img/logo.png

,where the image path is referencing the apps resources.

Do I need to do anything special to change the path from rel to abs before building the app? As far as I can tell, all settings are similar.

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
 
 

Reply all
Reply to author
Forward
0 new messages