Url form to reference local images on remote web pages
I am tryng to figure this out. I have an image in my resources folder. Let's call it /images/my.jpg
I have a remote page on my webserver I am opening in a webview. What url can I use to get the local image?
4 Answers
-
You can try using a relative URL to the JS scripts' location. For example if the JS script is in /Resources/windows/viewwindow and the image is in /Resources/images then your URL should be "../images/<image file name>".
Or you can code it relative to the Resources directory - ie from image_view_file.js in the kitchen sink…
var win = Titanium.UI.currentWindow; var f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'images/appcelerator_small.png');
-
I do not think I am explaining myself, or I do not understand. in the remote page at www.mysite.com/mypage.html. how can I pull images form my app? ie replace the <img src="/images/frontbox.png" />
-
Ooooh that way round… Umm, thats going to be a challenge. You may be able to do something with a fireEvent, tho its really a chicken and egg thing.
-
Hi there Laney,
I'd be very surprised if a remote web page was able to access files on a the device. you might have to write a service on the server and use a 'put' call from Titanium to send them.
Alternatively you could 'mash-up' a webView and an imageView in the same window, but the image would only be seen on your device.
cheers,
Chris.Nice seasonal reference there Gregor!