PDA

View Full Version : new member; coding question



wanderinon
03-24-2007, 05:15 AM
I just joined this forum, and haven't had time to check it all out yet, so please pardon me if I accidentally make any ettiquette mistakes.

I am just in the beginning stages of learning to write html, and am playing around with an experimental webpage, using editpad lite, with Internet Explorer (not sure which version, but definitely one of the newer ones) as a browser. I am trying to insert an image (the image belongs to me, it's not a download), and also to use an image as a background (a really simple cloud jpg image, taken with my digital camera).

I've tried every version of the img tag that I can find, using the w3c html tutorial, a book called the "html bible", and online hp webbuilding classes. I know that my code is correct. But I still can only get the little red x that shows up when the browser can't find the image. The images and the html document are in "my documents", so they're all in the same folder. I can't figure out for the life of me what I'm doing wrong.

Someone recently told me that it might be because of the security settings on my computer, but they weren't sure what the settings were, or what might need to be changed in order to allow the images to show up on the webpage. Is there any truth in this theory? If so, does anyone have any suggestions?

Any help I can get would be SO appreciated. I finally got the hang of URL's, but images are making me crazy.

My sincere thanks,
Lori (wanderinon)

thetestingsite
03-24-2007, 05:23 AM
What's the code on your page, and what is the directory structure like. Without this, we really can't be of much help (unless you were to post a link to the problem page - although, from what it sounds like, you are working locally without a webserver installed.)

The only thing I could suggest; without seeing any code or directory structure, would be to make sure you are typing in the "URL" of the image correctly. Either this (as an example):



<img src="C:\Documents&#37;20and%20Settings\User\My%20Documents\image.gif">


or this:



<img src="image.gif">


Hope this helps.

wanderinon
03-24-2007, 05:43 AM
Wow, that was quick! (I checked the thank you link, I'm not sure what that's all about but I'll figure it out...anyway, I digress)

Ok, to answer your question as best I can, because I don't quite understand the whole directory path issue completely yet; I'm working on that: The photographs have different names, but I'll start with the background image.

I went outside and took a picture of the sky. When I uploaded it to my computer, I called it "background.jpeg", to keep it simple, and placed it in "my documents". The code I used was:
<body background="background.jpeg">

For the images, it was very much the same type of thing. The image is called "logo.jpeg", and it also is in "my documents". The html document is in "my documents" too, and the code is:
<img src="logo" width="150" height="150"></img>
(I put an "end image" tag in at the suggestion of someone I met who writes code and said that sometimes it helps, but he didn't actually see the document.

These are the only two that I'm working with at the moment, because I want to figure them out, and by doing that, then I'm hoping that I'll understand enough to add the other images.

Again, thank you so much, I really do appreciate any suggestions. I'm VERY new at this, but I want very much to learn.

Lori

thetestingsite
03-24-2007, 05:47 AM
I went outside and took a picture of the sky. When I uploaded it to my computer, I called it "background.jpeg", to keep it simple, and placed it in "my documents". The code I used was:
<body background="background.jpeg">


Does the background image work (meaning are you able to see a background image)?



For the images, it was very much the same type of thing. The image is called "logo.jpeg", and it also is in "my documents". The html document is in "my documents" too, and the code is:
<img src="logo" width="150" height="150"></img>


Two things in that quote. The first is that you didn't specify the src as logo.jpeg. Instead, you simply have logo. The second; to my understanding, there is no (valid) closing img tag. I have been wrong in the past, but I am almost 100% sure that this is the case. Anyways, you would want it to look like this:



<img src="logo.jpeg" width="150" height="150">


Hope this helps.

wanderinon
03-24-2007, 06:02 AM
Does the background image work (meaning are you able to see a background image)?

No, the background is white. The strange thing is that before I started trying to do this, I used: <body bgcolor="(the number of the color">, and that DID work.



Two things in that quote. The first is that you didn't specify the src as logo.jpeg. Instead, you simply have logo. The second; to my understanding, there is no (valid) closing img tag. I have been wrong in the past, but I am almost 100% sure that this is the case. Anyways, you would want it to look like this:



<img src="logo.jpeg" width="150" height="150">


Hope this helps.

I went to the document and changed it, to reflect what you wrote, and it's still an x. (Interestingly enough, the word code is now on either side of the little red x! lol) I think I had actually tried that variation at one time or another while I was trying to find out what I was doing wrong and changing the code repeatedly, but I can't be absolutely sure, since I've tried so many variations, but no, again, it's still not working.

That's why I'm wondering if this might be a security issue with my computer, as was suggested to me. Anyway, I shouldn't keep taking up your time, but thank you...I'll keep working on it!

Lori

thetestingsite
03-24-2007, 06:09 AM
I have never heard of a security setting that would block images. Then again; as said before, I could be wrong. I believe that it when calling items (whether it be a link or an image, etc) it is case-sensitive (spelling?). Check to make sure that it is in fact named logo.jpeg and not a variation of:

logo.jpg
logo.JPG
logo.JPEG
logo.gif
logo.png
logo.PNG
and some other variations that I should'nt have to list. Other than that, without seeing the code or a link to the site (as said before) really can't be of much help.

Hope this helps though.

Added Later: Something else you may want to try would be uploading the files to an actual webhost (or download and install a WAMP server on your computer). Another thing, in IE (what ever version), try the following:

> Tools > Internet Options > Security (tab) > Intranet > Make sure everything is set to "Enable" or "Prompt" just to make sure it isn't a security setting.

wanderinon
03-24-2007, 06:26 AM
Sorry about that...I answered your background question, but being inexperienced with the quote function and using it wrong, the answer ended up being in the quote itself. It is not working. The background is showing up white, using the code <body background="background.jpeg"> but when I used <body bgcolor="green"> it was green, so you must be right. It must not be a security issue.

I wish I could post a link to the document, but you're right there too, it isn't being hosted on a server, it's only an experimental page on my html editor.

The other code is now: <img source="logo.jpeg"> and I took out the </img>, and it's an exact match to the photo name itself. I'm just totally baffled here. But I do appreciate all the time you've taken, and I'll keep plugging away at it. I know it has to be something I'm doing incorrectly, but I will get this if it kills me. <grins>

Thanks again,
Lori

thetestingsite
03-24-2007, 06:34 AM
Did you view my edit(s)? If you are still having trouble with it on your local system (without running a webserver), your best bet would be to either download and install a WAMP package for your computer or look into getting a free webhost. Simply to rule out the possibility of it being a coding error. If you want, I can set you up a test account on one of my servers. Let me know, and I will set it up. Or you can view my "tutorial on how to set up WAMP on your home computer by going to mburt's wiki (http://mburt.mb.funpic.org/wiki/?p=libresult&title=How&#37;20to%20set%20up%20WAMP)

Hope this helps.

wanderinon
03-24-2007, 06:46 AM
Did you view my edit(s)? If you are still having trouble with it on your local system (without running a webserver), your best bet would be to either download and install a WAMP package for your computer or look into getting a free webhost. Simply to rule out the possibility of it being a coding error. If you want, I can set you up a test account on one of my servers. Let me know, and I will set it up. Or you can view my "tutorial on how to set up WAMP on your home computer by going to mburt's wiki (http://mburt.mb.funpic.org/wiki/?p=libresult&title=How%20to%20set%20up%20WAMP)

Hope this helps.

Wow...that is the nicest offer! To be honest, we are getting into things that are way over my head, but I'm willing to try anything at this point. I have no clue what a WAMP is, or what to do with it, but I do have one problem with downloading anymore things to my computer, and that is that my disc space it almost used up...I'm trying to figure out what I can get rid of to allow me more space (things like multiple media players and such)...but if you're willing to bear with me, I would be really grateful for the help with a test account. Would it help if we took this to IM? I have aim, yahoo and google talk.

thetestingsite
03-24-2007, 06:49 AM
Sure, take a look at my profile and add me to your yahoo.

wanderinon
03-24-2007, 06:53 AM
I opened yahoo and sent a request to you to become part of my buddy list.

thetestingsite
03-24-2007, 06:57 AM
Ok, for some reason, I did not recieve it. Did you send it to the right username?

wanderinon
03-24-2007, 07:00 AM
sorry for the delay, I'm working, and my daughter also just called me (she's having some throat problems and just wanted to talk), but I'm sending it to the correct address now.

Bob90
03-24-2007, 12:03 PM
You can use img close tags with strict xhtml

<img/>

thetestingsite
03-24-2007, 02:41 PM
Yea, but that is still not a closing tag for <img> (such as what the OP posted before)



<img ...></img>

Twey
03-24-2007, 03:31 PM
Yea, but that is still not a closing tag for <img> (such as what the OP posted before)Yes it is. <img /> is directly equivalent to <img></img> in XHTML. It's just shorthand.

fuhrmann
03-27-2007, 02:01 PM
Ok, to answer your question as best I can, because I don't quite understand the whole directory path issue completely yet; I'm working on that: The photographs have different names, but I'll start with the background image.

I went outside and took a picture of the sky. When I uploaded it to my computer, I called it "background.jpeg", to keep it simple, and placed it in "my documents". The code I used was:
<body background="background.jpeg">

For the images, it was very much the same type of thing. The image is called "logo.jpeg", and it also is in "my documents". The html document is in "my documents" too, and the code is:
<img src="logo" width="150" height="150Lori

From what I see, I think that the others may have missed that you "don't quite understand the whole directory path issue completely yet;".
It may be your whole problem.

The directory structure issues are the same as they are for finding and using files on your computer.
You could have dozens of files named background.jpg in any of thousands of directory locations on your computer.
Your web page file could also be in any of those places on your computer.

When you tell the web browser <body background="background.jpeg">, it makes an assumption that the background.jpeg file is in the same location as the HTML file. It will not go looking for it in the c:\[some path]\my documents directory.

As a first attempt, try putting the background and logo files in the same directory as your HTML file.

Hopefully that fixes things for this learning experiance.
After that, a lot depends on what or how much style you want your programming (HTML is just a programming language for displays) to have.
If you pile everything in your main directory, it becomes a mess where it is hard to determine what is current, what is old experiments, and what can be thrown out.
You have to decide on what kind of structure you want.
Frequently, people create a new directory for each project. Depending on how complicated the project is, it may have directories under it to contain the graphics or other sections of the project.

Bill Fuhrmann

P.S. I am also a relative newbie to web coding.

Satan420
03-28-2007, 06:25 AM
Tried this to see if I could get it to work with a jpg of my dog in the my documents folder and for the life of me couldnt do it. So i tried it with Dreamweaver and got this
<img src="file:///C|/Documents and Settings/User/My Documents/Kota.jpg"
width="500" height="400" />
That | instead of the colon threw me. Hope that helps. And don't worry about getting in over your head thats how ya learn :)