img src in webspeed

anandknr

Member
Hi all,

I have an issue with image tag in html page.

In my project there are two folders, html and img .
html folder contains the html files and img folder contains the images.

I have a home.html and the only html tag it contains is <img src="../img/home.jpg"> and the img folder contains this home.jpg .

when i open it locally in a browser (right click open with IE) everything ok....home.jpg is showing.

Now, i compiled the home.html without any errors and when run from the server image home.jpg is not showing.


As my senior said i put the home.jpg in the folder /var/www/html/images ...now its showing when run from the server.
But i want to put home.jpg in my application folder(img folder) not in apache folder.

How could i do this...please help
 
The short answer will be... listen to your senior :)

The long could be in web applications we have dynamic and static content, static content is best served by the web server itself and for that need to be made available under it's DOCUMENT_ROOT somewhere. You simply have to define the folder structure for static content (make it configurable instead of hard-coding it all over the source code) and then reference static objects using that relative path.

As soon as you 'compile' the home.html file it turns in a dynamic content that will be served by the webspeed broker, it's URL will look something like http://server/cgi-bin/wspd_cgi.sh?.../home.html. Now, if you try to get to the image using relative path the URL will still point to the webspeed CGI messenger script and the webspeed broker can only handle dynamic content (aka running some progress code)... this is not to say that you can't build webspeed code that stream back static content but you sure do not want to do that for images, maybe when generating reports.

It's the same as with other web server-side technology (PHP, ASP)... although one can stream static content from the run-time interpreter there is no point in overloading the server with something that can be better served by the web server itself, most of the static content get's cached on the client at some point while serving it dynamically can make it not to be cached.

Bref, just listen to your senior developer or ask for some training but there is little webspeed specific in that area... check out how things are done in PHP or ASP, you'll find plenty of resources on those two on the internet.
 
I was working as a php developer for the last 2 years and i am pretty sure that <img src="../img/home.jpg"> will work in PHP.:mad:

Any way i got the concept of why image is not showing there...
 
well, i guess with a a little bit of configuration effort one might make it work for webspeed as well...

something like that could work for apache (might)

Code:
AddType application/x-httpd-webspeed .w
Action application/x-httpd-webspeed "/cgi-bin/wspd_cgi.sh"
[/FONT][/COLOR]

but the point was, not every developer need to bother with this kind of issues... there should be someone who made the decision on how the application structure is laid down and then everyone should play along (or try to convince that person there is a different/better way) :)
 
Back
Top