LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-10-2009, 06:39 AM   #1
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
html code not working....


Hello all.

I have dansguardian working and thought to customize the access denied page with the logo of the company and some look and feel. There is an image embedded that does not show up though the page is displayed. The location where image should be is blank. This is what I have done and I do not know why it is not working on the dansguardian though it is working on my desktop.

Code:
<img src="file:///etc/dansguardian/languages/ukenglish/logo.jpg" width="550" height="103" />
Now I am not programmer or designer so I have no idea if this ok or not but I have looked around and this seems ok as page was designed by our designer.
Dont ask if the logo.jpg file exists or not. It does and is spelled correctly.
Any other comments would be appreciated.
 
Old 02-10-2009, 06:51 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
you can't use file:// in a url, that's nonsense unless you're viewing it on the local machine. you have to use http references.
 
Old 02-10-2009, 07:41 AM   #3
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Then how do I do that? I got this syntax from LQ when I needed to insert my signature in Thunderbird. Now if I have to give http:// reference then how do I give it?
And why do I need http reference? The logo and the html code are both on same machine in same directory. This is just a html page that dansguardian will display on client browser if they try to surf url that is banned.
I tried to look into the properties of image from browser and it shows the correct location where the logo is but still the image is not displayed.
What I thought was that HTML code will just pick up the image from the image location source I specify and will display.
How do I do that now?
 
Old 02-10-2009, 07:50 AM   #4
rsciw
Member
 
Registered: Jan 2009
Location: Essex (UK)
Distribution: Home: Debian/Ubuntu, Work: Ubuntu
Posts: 206

Rep: Reputation: 44
put the image into the web server's document root and then use http://...

using file:/// tries to get the image on the client's box.
 
Old 02-10-2009, 08:04 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
html is CLIENT side, not SERVER side it's your browser that interprets it, not the remote server.
 
Old 02-10-2009, 08:07 AM   #6
dickgregory
Member
 
Registered: Oct 2002
Location: Houston
Distribution: Arch, PCLinuxOS, Mint
Posts: 257

Rep: Reputation: 34
I have the best success using a relative path. For example, if you put the image in the same directory as your html file, you can just use
Code:
<img src="logo.jpg" width="550" height="103" />
 
Old 02-11-2009, 04:18 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dickgregory View Post
I have the best success using a relative path. For example, if you put the image in the same directory as your html file, you can just use
Code:
<img src="logo.jpg" width="550" height="103" />
Thats what I did but I could not make logo displayed on browser. But I am still confused why is this termed as url. It is not.
But as advised will try http:// method and then revert back with what the outcome is.
 
Old 02-11-2009, 04:36 AM   #8
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
That does not work out. Now there is a confusion. If I create a website that is purely based on HTML and I need to display some images that I have on server why will I give the path to be http:// ?
I still feel the img tag that I used was ok but somehow image wasnt getting picked up.
Any other advises?
 
Old 02-11-2009, 04:50 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
if you think that that is correct, then I have to say that shows that you aren't understanding html / http to any great extent. As i said, html is CLIENT side. the web server just gives a text file to your browser, it has NO interest in what is in it. css, html etc... are all things that your browser is responsible. How can you tell a browser to open a file:// ??? it makes no sense whatsoever, as the browser, if it even supports file:// which is non-standard, will be looking at it's OWN disks, and that's just a mess then. you have to use an http reference, and once you realise why, you'll feel pretty sheepish in hindsight.
 
Old 02-11-2009, 04:58 AM   #10
General Failure
Member
 
Registered: Jan 2007
Location: Germany
Distribution: Slackware 13.37
Posts: 387

Rep: Reputation: 35
Quote:
Originally Posted by dickgregory View Post
I have the best success using a relative path. For example, if you put the image in the same directory as your html file, you can just use
Code:
<img src="logo.jpg" width="550" height="103" />
Do it like this, it's the most easy way. And read a bit about HTML
 
Old 02-11-2009, 05:31 AM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Yes, absolutely, BUT realise that relative paths ARE http links implicitly...
 
Old 02-11-2009, 07:41 AM   #12
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rsciw View Post
put the image into the web server's document root and then use http://...

using file:/// tries to get the image on the client's box.
That is not working. I cross checked it. Is there any other thing that I need to look into. Something that has been missed previously?
 
Old 02-11-2009, 08:17 AM   #13
rsciw
Member
 
Registered: Jan 2009
Location: Essex (UK)
Distribution: Home: Debian/Ubuntu, Work: Ubuntu
Posts: 206

Rep: Reputation: 44
what exactly is not working?
where is the image?
where is the html file?
how did you cross check it?

html file I assume is on the webserver, right?
image hopefully too, right?

so take the image's path in the webserver and hit that into the <img> tag

errm yeah, when both are local, leave that "http://" out of it, only if it's remote

Last edited by rsciw; 02-11-2009 at 08:21 AM. Reason: added a line
 
Old 02-11-2009, 08:51 AM   #14
dickgregory
Member
 
Registered: Oct 2002
Location: Houston
Distribution: Arch, PCLinuxOS, Mint
Posts: 257

Rep: Reputation: 34
I'm not familiar at all with dansguardian, but it looks like one of its functions is to be a web server. As such, it must have a configuration file that tells it where the root directory of its website is located. That is the folder where your html and img files should be. The config file is probably under /etc/dansguardian, since that directory is included in the file path you specified in your original post. However I find it unusual that any content would be served from a directory under /etc. It is more often under a directory like /var.

If you can show us where your relevant files are we can better help you position them where they need to be. And don't be embarrassed that you might reveal that everything is out of its proper place. We've all done that.
 
Old 02-11-2009, 09:49 AM   #15
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Right, I'll put up an example of this using one of my actual websites (currently in development so don't be too judgmental =P).

It's http://andraslife.com/ you'll notice in the top left hand corner their is a logo image. It, in itself is hosted on the same Virtual Machine as the website. The image is referred to in the source code by...

Code:
<img class="logoimg" src="/logo/logo.png" alt="Andra's Life" />
It is relatively stored to the page itself in a directory of logo as a picture called logo.png. The page itself is stored exactly at /var/www/html/andra/index.php and the image is stored at /var/www/andra/logo/logo.png. Because it's a relative link to andraslife.com, it simply calls up andraslife.com/logo/logo.png by ammending the said /logo/logo.png to the end of the current URL/domain... hope that makes more sense.

If you still do not understand, you can supply your URL (Universal Resource Locator) for your site and where the image is relative (in physical file system path) to the actual site/page that is trying to view it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
adding index.html to /var/www/html not working dannyboy990 Linux - Newbie 1 09-30-2007 09:43 AM
html code and including html files Hockeyfan Programming 2 08-22-2005 06:11 PM
User Preferences: Use HTML code instead of vB code? (vB code is overrated) stefanlasiewski LQ Suggestions & Feedback 5 07-26-2005 02:37 AM
HTML code off pe2338 LQ Suggestions & Feedback 2 08-27-2003 03:03 AM
HTML code is OFF ??? phreakazoid LQ Suggestions & Feedback 5 07-24-2003 01:25 PM


All times are GMT -5. The time now is 05:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration