Jump to content

Apache html problem


G-Stress

Recommended Posts

Guys i'm having a problem simple problem with html I know. For some reason I cannot set any image as a background. Everything else html-wise works fine, but for some reason not any background code.

<table height="100" width="150" background="http://www.tizag.com/pics/htmlT/pattern.jpg" >

that's an example found at www.tizag.com

I've also tried all examples found there, but here's the problem I think I've having. I'm using Apache as my web server hosting this all from my machine running server 2003 enterprise.

I'm not sure where to put the images and how to code it for background and actually I haven't tried posting images yet but i'm sure I'd have the same problem as now. I tried the images folder with the code

<table background="C:httpserverimagesbackground.jpg">

C:httpserver just being the location I have the images folder and index.html folder in.

I know this has to be so simple, oh forgot I'm using just standard notepad to code the site saving as .html files

It's been since '02 since i've done any real html :oops:

Link to comment
Share on other sites

<table height="100" width="150" background="http://www.tizag.com/pics/htmlT/pattern.jpg" >

...

<table background="C:httpserverimagesbackground.jpg">

C:httpserver just being the location I have the images folder and index.html folder in.

...

OK, using c:... is pointless. you can't access a drive letter from an apache context. A full URL will work (http://yourdomain.com/imagedirectory/image.jpg) or even a relative directory to your defined documentroot, which is <installdir>/htdocs by default on windows apache. So, /imagedirectory/image.jpg or something.

Or better yet, try using CSS and using background-image:url('/image/')

Link to comment
Share on other sites

Ahh, I see. This is the first time I'm completely hard-coding everything so I'll get real familiar real quick. Thanks Oberon I'm gonna give that a try in a few min. I knew it had that something with the location of the image relating to the code had to be the problem, just didn't know how to do it when hosting my own server :oops:

Thanks again.

Link to comment
Share on other sites

Umm... I am hosting my server via a dyndns name and when trying that code

<table background="http://dnsname.dyndns.org/images/imagename.jpg">

That didn't work, but if I were to use that I'm not sure how it would know that

I also tried

<table background="/images/imagename.jpg">

and still no luck. Is there a certain configuration in the apache httpd.conf file? I looked through it and searched for "image" and only like 3 words of image came up and it was talking about imagemap_module and then under DefaultType: :?

What' I'm doing is just trying to get a background working coding in notepage with the test.html file and opening it in FireFox and refreshing it to see if I have a background yet, but I don't yet:(

Link to comment
Share on other sites

Umm... I am hosting my server via a dyndns name and when trying that code

<table background="http://dnsname.dyndns.org/images/imagename.jpg">

That didn't work, but if I were to use that I'm not sure how it would know that

I also tried

<table background="/images/imagename.jpg">

and still no luck. Is there a certain configuration in the apache httpd.conf file? I looked through it and searched for "image" and only like 3 words of image came up and it was talking about imagemap_module and then under DefaultType: :?

What' I'm doing is just trying to get a background working coding in notepage with the test.html file and opening it in FireFox and refreshing it to see if I have a background yet, but I don't yet:(

:P /images/imagename.jpg was an example. you need to see what your documentRoot is set to, then everything will be relative to that. So, for example, if your documentRoot is /var/www/ and you've created a directory called images, then the html would be <table background="/images/<imagename> or whatever the image name is. No other configuration is necessary.

Link to comment
Share on other sites

Umm... I am hosting my server via a dyndns name and when trying that code

<table background="http://dnsname.dyndns.org/images/imagename.jpg">

That didn't work, but if I were to use that I'm not sure how it would know that

I also tried

<table background="/images/imagename.jpg">

and still no luck. Is there a certain configuration in the apache httpd.conf file? I looked through it and searched for "image" and only like 3 words of image came up and it was talking about imagemap_module and then under DefaultType: :?

What' I'm doing is just trying to get a background working coding in notepage with the test.html file and opening it in FireFox and refreshing it to see if I have a background yet, but I don't yet:(

:P /images/imagename.jpg was an example. you need to see what your documentRoot is set to, then everything will be relative to that. So, for example, if your documentRoot is /var/www/ and you've created a directory called images in /var/www, then the html would be <table background="/images/image.jpg or whatever the image name is. No other configuration is necessary.

By default, apache uses <installdirectory>/htdocs on windows and /var/www on *nix.

Link to comment
Share on other sites

hmmm... man still not working. My document root is set to C:httpserver I also tried "http://localhost/images/image.jpg" in the code and still nothing.

What's weird is if I type http://localhost/images/image.jpg in the address bar it'll take me straight there to the image. I shouldn't have to restart the apache service should I?

It would suck if so cause what I do is edit a copy of my index.html file and when I get it where I like i overwrite the existing index.html file.

I tried so far

http://localhost/images/image.jpg

/images/image.jpg

http://dnsname.dyndns.org/images/image.jpg

I think eventually I might figure it out since I know what the problem is, just not exactly sure how to code it. Thanks alot though for the advice and quick responses Oberon

:D

Link to comment
Share on other sites

What's weird is if I type http://localhost/images/image.jpg in the address bar it'll take me straight there to the image. I shouldn't have to restart the apache service should I?

...

I think eventually I might figure it out since I know what the problem is, just not exactly sure how to code it. Thanks alot though for the advice and quick responses Oberon

:D

No problem. If http://localhost/images/image.jpg works, then the problem is that you're using Firefox. the <table background=""> is non-standard and works in Netscape and IE. Try using CSS and background-image:URL('')

Link to comment
Share on other sites

Oh dude, sorry my fault man. I completely forgot you mentioned CSS earlier in this thread. :oops: I just keep thinking html because I'm trying to become proficient in html and further web developing. I definitely will give that a try tomorrow and I'm sure it'll work, however I did try IE and FF, with all the code that I tried, I don't use netscape.

Thanks again buddy:)

Link to comment
Share on other sites

hmm coz Oberon was using an example, im gonna use his method on ur script, just so it shows totaly to u.

&lt;table height="100" width="150" background="http://www.tizag.com/pics/htmlT/pattern.jpg" &gt;

should be

&lt;table height="100" width="150" background="/pics/htmlT/pattern.jpg" &gt;

this is so links are dynamic

Link to comment
Share on other sites

hmm coz Oberon was using an example, im gonna use his method on ur script, just so it shows totaly to u.

&lt;table height="100" width="150" background="http://www.tizag.com/pics/htmlT/pattern.jpg" &gt;

should be

&lt;table height="100" width="150" background="/pics/htmlT/pattern.jpg" &gt;

this is so links are dynamic

That didn't work. I tried that already. Man it just doesn't make sense. In the apache documentation, well in the httpd.conf file it doesn't give me any special configuration for images.

I'm having a bit of a problem using CSS I think it's just something missing from the code, I've done a partial virtual html training tutorial and they covered a bit about CSS I'm just tryin to find my notes now and hopefully i'll get this figured out tonight.

Thanks guys.

Link to comment
Share on other sites

YES! I finally figured it out guys :D

I was having problems with CSS it was my first time messing with that, but what I had to do was

<body background="http://localhost/images/image.jpg">'>http://localhost/images/image.jpg">

I first tried a bgcolor and it worked so I was like what the hell... I tried the image and bam.

Something I don't think was explained in the html virtual tutorial I have is

in the background code the ending ">" there is a space before it like if I used it in the code above it would be:

<body background="http://localhost/images/image.jpg" >

Why is the space necessary, that's the first html code I've noticed like that?

Thanks alot guys for all the help.

Link to comment
Share on other sites

That didn't work. I tried that already. Man it just doesn't make sense. In the apache documentation, well in the httpd.conf file it doesn't give me any special configuration for images.

I'm having a bit of a problem using CSS I think it's just something missing from the code, I've done a partial virtual html training tutorial and they covered a bit about CSS I'm just tryin to find my notes now and hopefully i'll get this figured out tonight.

Thanks guys.

The CSS is easy. It's just a variation of using the style="" attribute on an element, sort of like the background="" that you're using now. You could try:

<table style="background-image:url('/pics/image.jpg');">

<tr><td>Make sure that you either have content in the cell or define the width and height of the table.</td></tr></table>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...