dcsimg
www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 18

Thread: <img src="... not always working!

  1. #1
    Join Date
    Aug 2009
    Posts
    3

    <img src="... not always working!

    On my website I have several images showing, depending on the page.
    The images are not locally stored, the html img tags reference remote servers.
    The problem is that they don't always show.

    Ive tried putting a random "?rand=123" value in the URL to prevent caching - no success.
    If I copy the image links to another browser tab they show up and then refreshing the first page, the images come up immediately.

    can someone please help?

    With regards, S.Einarsson

  2. #2
    Join Date
    Nov 2006
    Location
    Springfield, MO
    Posts
    1,541
    Probably my lack of coffee intake at this point, but I don't understand the problem clearly enough to offer help.

  3. #3
    Join Date
    Jun 2005
    Location
    United Kingdom
    Posts
    1,043
    You are hotlinking images. Not surprisingly some site owners don't like this , and take measures to stop it.

  4. #4
    Join Date
    Aug 2009
    Posts
    3
    Ryan Butler : thanks, I have some <img src="..... tags on my webpage which are supposed to display images. sometimes the images show and sometimes they dont
    I&#180;d like them to show all the time obviously , thats the problem

    Kiwibrit: thanks, well if I take the image link and paste it in a new browser window the image displays fine!
    Ive checked a "hotlink check webpage" and it said that the image were not hotlink protected. This tells me to perhaps still avoid hotlinking because thats what ive been doing but on the other hand if the problem is not because of that which it seems it wasnt, the problem will remain, hotlinking or not hotlinking.
    Last edited by sigein; 10-12-2009 at 10:16 AM.

  5. #5
    Join Date
    Jun 2005
    Location
    United Kingdom
    Posts
    1,043
    Like ryanbutler, I am not clear what is going on, but from the way you are describing 'pasting into a new window' I am wondering if you may be discussing a javascript problem rather than a html one. Got a link which shows (or rather doesn't) the missing images?

  6. #6
    Join Date
    Dec 2009
    Location
    White Plains N.Y.
    Posts
    7
    OK first let me understand how to exactly use this forum
    First how do I post my questions
    Second is there an option where I can do this
    Third and most important I need help with my web I'm developing in Notepad I want to write in my own html and I'm having problems with the img, I try to load in my photo from my desk top file with the tag <img scr=> plus the height and width but the only thing I see when I launch it is an empty square with a pic of a broken icon
    what I'm I not doing right

  7. #7
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    It could be a couple of things. Post a link to the offending page and we'll take a look.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  8. #8
    Join Date
    Dec 2009
    Location
    White Plains N.Y.
    Posts
    7
    Hey Charles TK you for your quick response to my post
    OK I can not give you a link for the page I'm creating it still in production mode
    I also have not gotten hosting site to place it in I though to learn how to write the codes first then do every thing else
    Are this realistic steps to take or do I really need to have a hosting account plus domain to develop my site?

  9. #9
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    You can develop quite well without the hosting, but you might not catch all the problems that way.

    In lieu of seeing the patient I'll refer you to The Validator.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  10. #10
    Join Date
    Dec 2005
    Posts
    2,984
    Quote Originally Posted by elnewbie View Post
    OK first let me understand how to exactly use this forum
    First how do I post my questions
    Second is there an option where I can do this
    Third and most important I need help with my web I'm developing in Notepad I want to write in my own html and I'm having problems with the img, I try to load in my photo from my desk top file with the tag <img scr=> plus the height and width but the only thing I see when I launch it is an empty square with a pic of a broken icon
    what I'm I not doing right
    The src attribute in your img tag must point to the relative path of the image.
    For example, if I had a HTML file that I saved in a folder (called "website") on my desktop that had this in it:

    HTML Code:
    <img src="images/pics/some_picture.jpg">
    Then some_picture.jpg would be the image file. It would be located in the website folder, in a subfolder called images, and inside the images folder in a folder called pics and in the pics folder, there would be the file some_picture.jpg.

    Alternatively, I could put this in my HTML file:

    HTML Code:
    <img src="some_picture.jpg">
    In which case some_picture.jpg would be an image file located in the same directory as the HTML file.

  11. #11
    Join Date
    Dec 2009
    Location
    White Plains N.Y.
    Posts
    7
    Thanks dude I hope al is well

  12. #12
    Join Date
    Dec 2009
    Location
    White Plains N.Y.
    Posts
    7
    Right I do have an html folder name webdesign I've try to move the photo there int o a sub directory name html/my pic.jpg an it did not copy over

    aj nsc the scientist

  13. #13
    Join Date
    Dec 2005
    Posts
    2,984
    if you can't copy an image file from one place to another on your harddrive, then trying to get it to display in a webpage is the least of your worries....sorry.

  14. #14
    Join Date
    Dec 2009
    Location
    White Plains N.Y.
    Posts
    7

    thanks

    OK but I'll get better that's for sure I thought that this was the place to inf

  15. #15
    Join Date
    Dec 2005
    Posts
    2,984
    Don't misconstrue what I said. This IS the place to find info.....about web development.

    The src attribute of the img tag must point to an image file RELATIVE TO THE DIRECTORY THE HTML FILE IS IN! Right now, you can't even move your image file around on your computer (for whatever reasons), you're going to have a heck of a time trying to develop websites if you can't move files around.

    For example, I have files as below:

    C:\index.html
    C:\images\myimage.jpg

    In index.html, I would have to use
    HTML Code:
    <img src="images/myimage.jpg">
    in order for the image to show up.

    Another example:

    C:\websites\index.html
    C:\images\myimage.jpg

    I would have to use:
    HTML Code:
    <img src="../images/myimage.jpg">
    The ../ indicates the path to the image first goes up one level.

    Along these same lines if I had this:

    C:\websites\public_html\index.html
    C:\images\myimage.jpg

    I would have to use the following in my index.html:
    HTML Code:
    <img src="../../images/myimage.jpg">
    Now that little primer should explain what the src attribute of the img tag actually does and give you a better understanding of how to use it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles