Images that are not displayed in PhoneGap Build

Recently, I decided to start using PhoneGap Build to build web-based applications. Please note that I use PhoneGap Build not PhoneGap and therefore do not support my own APIs.

I use img HTML tags to display images, of course, and I have problems. Images display well in the browser, but when I take it to my phone, they just disappear. I tried everything: check case and spelling. I even tried uploading images to my site server and nothing.

Any help on this would be greatly appreciated.

UPDATE

I use this HTML code, this is a JavaScript string like the way I enter it at runtime:

"<p id=\"calculator\"><img id=\"images\" src=\"images/ calculator@2x.png \"><span id=\"converterTitles\">Calculator</span></p><hr><p id=\"distance\"><img id=\"images\" src=\"images/ Ruler@2x.png \"><span id=\"converterTitles\">Distance Converter</span></p><hr><p id=\"area\"><img id=\"images\" src=\"images/ Line-Graph-1@2x.png \"><span id=\"converterTitles\">Area Converter</span></p><hr><p id=\"volume\"><img id=\"images\" src=\"images/ box3@2x.png \"><span id=\"converterTitles\">Volume Converter</span></p><hr><p id=\"mass\"><img id=\"images\" src=\"images/ dumbells@2x.png \"><span id=\"converterTitles\">Mass Converter</span></p><hr><p id=\"force\"><img id=\"images\" src=\"images/ circle-east@2x.png \"><span id=\"converterTitles\">Force Converter</span></p><hr><p id=\"power\"><img id=\"images\" src=\"images/ Lightbulb@2x.png \"><span id=\"converterTitles\">Power Converter</span></p><hr><p id=\"energy\"><img id=\"images\" src=\"images/ Refresh@2x.png \"><span id=\"converterTitles\">Energy Converter</span></p><hr><p id=\"temperature\"><img id=\"images\" src=\"images/ thermometer@2x.png \"><span id=\"converterTitles\">Temperature Converter</span></p><hr><p id=\"dataStorage\"><img id=\"images\" src=\"images/ inbox@2x.png \"><span id=\"converterTitles\">Data Storage Converter</span></p><hr><p id=\"time\"><img id=\"images\" src=\"images/ Clock@2x.png \"><span id=\"converterTitles\">Time Converter</span></p><hr><p id=\"speed\"><img id=\"images\" src=\"images/ jeep@2x.png \"><span id=\"converterTitles\">Speed Converter</span></p><hr><p id=\"acceleration\"><img id=\"images\" src=\"images/ Cue-Forward@2x.png \"><span id=\"converterTitles\">Acceleration Converter</span></p><hr><p id=\"pressure\"><img id=\"images\" src=\"images/ Parking@2x.png \"><span id=\"converterTitles\">Pressure Converter</span></p><hr><p id=\"density\"><img id=\"images\" src=\"images/ beaker@2x.png \"><span id=\"converterTitles\">Density Converter</span></p><hr><p id=\"any\"><img id=\"images\" src=\"images/ Hand-Open@2x.png \"><span id=\"converterTitles\">The \"Any\" Converter</span></p><hr><p id=\"angle\"><img id=\"images\" src=\"images/Angle.png\"><span id=\"converterTitles\">Angle Converter</span></p><hr>"

It is stored with missing characters, so it is difficult to read. But you get the gist. The simplest tags do not work. I have CSS that does some background images using url () which also don't display.

+6
source share
6 answers

I managed to fix this by simply throwing the images in the root folder and contacting it. It may not be the best solution, but it works! Hope this helps any viewer. PhoneGap build applications require the images to be in the root folder.

+9
source

I had a similar problem. My solution was to change the image paths by removing the leading "/":/img/my_icon.png β†’ img / my_icon.png, then my icons appeared in the application. It seems that your paths are correct.

+28
source

I had problems with case sensitivity of the file name, after changing all the image file names to lower case and accessing them with the same case everything began to work fine.

+2
source

I found that both answers are correct. At least for me, the images should be in the root folder, and the case in HTML should match the real case of the image file name.

I use Nomad , so I don’t know if this is a Nomad problem when packing the application or problems with PhoneGap.

0
source

I had a problem with this when I used media queries in CSS. I forgot to keep in mind that CSS image paths refer to a stylesheet, not a document. So in my case, my path became ../images/...

0
source

It may be useful for developers using gulp to create their own applications: if the images do not appear, check where the images are placed in www after gulp build .

In my case, PhoneGap was looking for images in the /www/css folder. Modifying clean and images tasks to reflect what solved my problem.

I tried to set the background image using CSS; it works now using:

 background-image: url("img/background.jpg") 
0
source

Source: https://habr.com/ru/post/956782/


All Articles