Discussion Forums  >  Images, Documents, File Locations

Replies: 7    Views: 136

almosturban
Aspiring developer
Profile
Posts: 19
Reg: May 23, 2011
Canada
1,840
06/10/14 10:23 PM (7 years ago)

Can't get image to load in Custom HTML/Text Screen - Andrpid App

Hello, I have been working on an Android app but have come to an impasse on getting an image to load in the HTML/Text Screen. I am trying to load an image natively from the Buzztouch Doc folder. I think the issue may be with the HTML or where I am placing it. After I export my project I added the image to the doc folder. I have tried png and jpg versions of the image. I have tried a variety of html image tags to get it to work but all of the following would not load anything in the emulator. <p style="text-align: center;"> <img_homepagelogo.jpg> </img_homepagelogo.jpg></p> <p style="text-align: center;"> <img src="homepagelogo.jpg" /></p> <p style="text-align: center;"> <img src="homepagelogo.png" /></p> Any suggestions or assistance would be greatly appreciated. Thank you,
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/11/14 06:56 AM (7 years ago)
if your html file is in BT_docs, and your image is in BT_docs, this 'should' be working... <html> <head> </head> <body> <img src="./homepagelogo.png"> </body> </html> Cheers! -- Smug
 
almosturban
Aspiring developer
Profile
Posts: 19
Reg: May 23, 2011
Canada
1,840
like
06/20/14 09:49 PM (7 years ago)
Hi Smug, I tried that out but still no luck. I double checked the file name and everything else. Just to clarify, to I put "./" in front of the file name or write out the path to /BT_docs/homepagelogo.png ? Any other ideas what might be causing the problem? Any more info I can provide to help? Thank you for your assistance,
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/21/14 12:57 AM (7 years ago)
Well, it's all relative. And I mean that literally. The HTML document should reside in the 'BT_Docs' directory... Like all documents. But HTML is not Android (or iOS) and doesn't know about how the Android (or iOS) system handles images; it only worries about itself. Thus, if your image reference in the html document is: <img src="./myImage.png"> Then we expect it to be 'at the same directory level' as the document that references it, which in this case would be your BT_Docs directory. Does the HTML Document show, but not the image? Or does 'nothing' show? Cheers! -- Smug
 
almosturban
Aspiring developer
Profile
Posts: 19
Reg: May 23, 2011
Canada
1,840
like
06/21/14 10:29 AM (7 years ago)
Hi Smug, Absolutely nothing from the image is showing up but the HTML doc is appearing. I have some text which should be below the image which shows up at the top of the page, there is no broken image or space for the image, the text that is below it just moves up to the top of the screen. I tried doing the html page with just the image and no text in case that was causing a problem, and the html page just loaded as blank. I might have to just link to the image online, but would like to keep it native to the app if possible. Thank you,
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/21/14 07:52 PM (7 years ago)
Have you tried images from online? Have you tried a different image altogether? Remember gif files might be an issue; use only jpg or bmp files... Otherwise it 'should' be ok... If you're still having an issue, post a copy of your HTML and image somewhere and I'll test it on my side to see if there is anything different on my system... Cheers! -- Smug
 
almosturban
Aspiring developer
Profile
Posts: 19
Reg: May 23, 2011
Canada
1,840
like
06/22/14 10:36 PM (7 years ago)
Hi Smug, I switched to jpg, still could not get the image to load locally but I tried linking to a web image and that worked just fine. I will proceed with that for now so the immediate issue is solved. I will try doing the local image when I have more time again and see if I can get it working. Thanks for your help,
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1703
Reg: May 01, 2011
Hopkins, Minnes...
26,230
like
11/25/15 04:17 PM (6 years ago)
What worked for me was putting the image in the HTML Doc folder instead of the res/drawable. That way the reference worked. Thanks for your help, Smug! Not sure how long it would have taken me to figure that out if you hadn't posted here.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.