fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
10/31/12 09:50 AM (13 years ago)

Adding image to Custom HTML / Text screen

I am being thick here but try as I may, I cannot get this to work. This is what I have done: - Added the jpeg image to BT_Docs folder in BT - Dragged the same image to BT_Docs folder in Xcode - Created a new Custom HTML / Text screen - Gone to 'Source' settings - Added this line <img src=BT_Docs/imagename.jpg> (where imagename is the image file name) - Cleaned and rebuilt the project This is what happens... - On simulator I get a little blue box with a question mark - On iPhone I get a little box So far the only way I have managed to get the image to work is by using a link to a hosted image but I would rather not depend on this and instead get the image into the app. Any help would be appreciated.
 
Simon the Aspiring...
Aspiring developer
Profile
Posts: 18
Reg: Oct 12, 2012
Frankfurt am ma...
3,080
like
10/31/12 09:54 AM (13 years ago)
how about setting is just as a background image? would that work?
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
10/31/12 09:58 AM (13 years ago)
I don't think you need to reference the directory in your html. Try just img src="imagename.jpg"
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
10/31/12 10:07 AM (13 years ago)
Thanks for the suggestions but no joy so far. I don't think the background image will work as I want an image, then some text, then possibly another image. I removed the directory reference but it still doesn't seem to be working. Even on the Buzztouch screen I only get an image error icon when I switch back from 'Source' to look at the visual editor.
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
10/31/12 10:12 AM (13 years ago)
Thanks for the suggestions but no joy so far. I don't think the background image will work as I want an image, then some text, then possibly another image. I removed the directory reference but it still doesn't seem to be working. Even on the Buzztouch screen I only get an image error icon when I switch back from 'Source' to look at the visual editor.
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
10/31/12 10:17 AM (13 years ago)
I have several html pages (html docs, in my case) that reference images in the format I described above. You are putting quotes around the image name, right? img src="imagename.jpg"
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
10/31/12 10:24 AM (13 years ago)
the image error is normal, no worries with that. What I normally do and always works is dragging in a picutre from the web directly in the visual editor. Know what I mean? Drag an image from a browser website directly in the editor and then right click on image properties. replace the URL there with imagename.jpg and it will work perfectly. put the image in the BT_images folder, compile , done.
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
10/31/12 10:34 AM (13 years ago)
Yes - it's working now - thanks so much - I think it was the quote marks.
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
10/31/12 10:40 AM (13 years ago)
100% quote mark problem :-)
 
Simon the Aspiring...
Aspiring developer
Profile
Posts: 18
Reg: Oct 12, 2012
Frankfurt am ma...
3,080
like
11/01/12 05:00 AM (13 years ago)
I am having the same issue now! The picture is showing as a white box with a red cross through it. It's a custom HTML page, have uploaded the image to BT Documents, attached it into Eclipse, and now using the <img src="imagename.jpg">, but no joy...
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
11/02/12 03:40 AM (13 years ago)
Hmmm, I'm having another problem picking up with this today too. Having resolved the issue above, I set about changing another image that had been using a hosted reference. I followed exactly the same process but when I checked on my iPhone all I could see was a small grey-edged box. I tried several versions of the image but nothing changed. Then I changed the image name to the one I had used on the earlier screen above. It appeared straight away on this screen too. I changed back to the image I wanted and back to the grey edged box. The quote marks and everything else stayed - I just changed the exact file name. I have checked and double checked the file name and it is correct. The I tried simulator and the correct image appeared just as it should. Does anyone have any ideas? Also, has anyone ever experienced something just not working on an actual device (using ad hoc distribution) when everything is actually ok (or is that just clutching at straws?). Many thanks as ever, Tony
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
11/02/12 04:24 AM (13 years ago)
Tony, When you test on a device, are you re-compiling to the device each time you change an image (add, or rename)? Also, have you tried doing a "Clean" on both the device and simulator? And if that doesn't work, you can always try to delete the app (and click yes when it says to delete all data) and re-build.
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
11/02/12 04:40 AM (13 years ago)
I have been running 'clean' and then 'run' for each version - is this what you mean for recompiling? If so, that's not fixing it. When you say 'rebuilding' - does this rebuild from where I am on BT or do I have to start everything again from square one? Thanks for the input.
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
11/02/12 04:51 AM (13 years ago)
rebuild = "run" (in xcode) or compile. I get my terminology mixed up sometimes :) Sometimes people will add images to Xcode, and try to refresh on their device without hooking it up via USB. That why I was asking if you rebuilt to the device. Another thing to try is to delete the image from Xcode (and do the "delete" delete, not the "remove references" option). Then re-drag the file into xcode and select "copy" source into project.
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
11/02/12 05:26 AM (13 years ago)
Excellent - deleting the image and restarting the process seems to have worked - thanks. I wonder if anyone can explain the situation with ad hoc distribution and updates. I have three other people able to see this app through ad hoc distribution on their iPhones (although they are on different provisioning profiles because I added them at different times). Slightly amazingly (to me at least) when I update the app, the updates seem to appear on their phones without them even connecting - how on earth does that happen? But, sometimes - especially with these images - we don't all see exactly the same thing. It's not as simple as not updating on some phones, because of a batch of changes, most might appear in sync but one or two don't. What experiences have other people had with this, and which 'build' do the ad hoc remote devices take their feed from? Thanks again for all your help.
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
11/22/12 04:49 AM (13 years ago)
I'm back now trying to do the same thing (add images to a custom html page) for what is essentially the identical app but for Android on Eclipse and I'm just getting, literally, a blank screen. This is what I've tried: 1) In BT I've uploaded the jpg image file into the documents folder 2) In Eclipse I've added the same image file to the BT_Docs folder 3) In BT I've added the code <img src="imagename.jpg"> to the screen html 4) I've cleaned and re-run the project in Eclipse I can happily add and edit text, but I see no image when I do this above process. Can anyone see anything I'm missing this time or let me know if anything is different in Eclipse from Xcode? Many thanks.
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
11/22/12 06:45 AM (13 years ago)
Ok - I may have a solution - unlike Xcode, the source reference seems to need to be spelled out in more detail so I can now get it to work using the following code: <img src="file:///android_asset/BT_Docs/imagename.png" /></p> Not sure if this is the right answer but it is the first thing that has made any of my images appear. P.S. Happy Thanksgiving to all in US (and elsewhere too!)
 
fratony
I hate code!
Profile
Posts: 77
Reg: Aug 14, 2012
Devon
5,370
like
11/26/12 05:16 AM (13 years ago)
Ok - I may have a solution - unlike Xcode, the source reference seems to need to be spelled out in more detail so I can now get it to work using the following code: <img src="file:///android_asset/BT_Docs/imagename.png" /></p> Not sure if this is the right answer but it is the first thing that has made any of my images appear. P.S. Happy Thanksgiving to all in US (and elsewhere too!)
 
snits
Aspiring developer
Profile
Posts: 5
Reg: Aug 21, 2013
Sneek, Nederlan...
4,950
like
05/29/14 05:18 AM (11 years ago)
Thanks for the answer, i added file:///android_asset/BT_Docs/ to my src and it worked, thank you!
 

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.