Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

how to get img src=

[EDIT]
My topic got messed up when posting.
It should read "how to get img src=[path to ApplicationData-directory] to work"
[/EDIT]

Hey folks.

I am developing a desktop app that will be updated by communicating with a server, downloading an XML-file of updated files (images, js and css) and then download the updated files to the application data directory ( retrieved from Titanium.Filesystem.getApplicationDataDirectory() ).

Now, my problem is that when i f.x. want to display the images, I can't seem to use the value thet I get from the getApplicationDataDirectory-function to set the path to the image. I had an idea of having a php-file in the application-directory (not data-directory) with

<?php
header('Content-type: image/png');

echo file_get_contents($_GET['path']);

?>

and then doing

<img src="img.php?path=[path-to-file]">

But since i can't access the Titanium API when prerendering the PHP and i can't pass the value of a JS-variable to the PHP-file, I feel as if I have hit a wall.

I am thinking of changing the src-values using JS on every image, but this doesn't seem efficient especially since I have a lot of images and also css and js-files that need to be fetched from the application data directory.

I am probably missing something very simple here so if anyone have a solution or a suggestion to push me in the right direction, please feel free to speak up :)

Thanks.

— asked July 23rd 2010 by Björn Folbert
  • applicationdata
  • desktop
0 Comments

0 Answers

The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.