Which is better to call an image

Discussion in 'Web Hosting' started by suraja, Sep 19, 2010.

  1. #1
    Which do you think is better to call for an image, for better hosting resource

    1. Using http://domain.com/image.jpg

    Or

    2. Using path such "/image.jpg"
     
    suraja, Sep 19, 2010 IP
  2. [HB]Rob

    [HB]Rob Peon

    Messages:
    76
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There is no reason to use full domain in your site coding, when "/image.jpg" works just as well and it's simpler... full domain links are only used when calling images hosted on other domains.
     
    [HB]Rob, Sep 19, 2010 IP
  3. suraja

    suraja Peon

    Messages:
    537
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Then how about this third option, using php code on Wordpress such : <?echo get_settings('siteurl');?>/image.php
     
    suraja, Sep 19, 2010 IP
  4. Mike224

    Mike224 Well-Known Member

    Messages:
    80
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    100
    #4
    That doesn't really sound like a third option (PHP is a server side language, and this function will return either relative/full paths as one of the first 2 options)

    Have you thought about background images and using sprites. Spriting background images is a good way to boost performance and make your site a little more organised.

    Lots large sites use spriting (twitter, linkedIn, facebook, digg etc etc)

    What do you mean by "better"?
    --> If you're looking for performance then search spriting background images
    --> If you looking for portability then go with the relative path (you may rename your site at some point... who knows)
     
    Mike224, Sep 19, 2010 IP
  5. vitalbusiness

    vitalbusiness Peon

    Messages:
    882
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I believe this one gets out faster. Because it circumvents calling the entire domain name.
     
    vitalbusiness, Sep 19, 2010 IP
  6. Ligra

    Ligra Member

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #6
    Just simply use paths, there is no reason for the full domain.
     
    Ligra, Sep 19, 2010 IP
  7. zzbomb

    zzbomb Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Paths are also better if you change domains, or need to test the script/html/whatever locally or somewhere else.
    I design all my work on my personal computer, than upload it. So its necessary to use paths and not domains.
     
    zzbomb, Sep 19, 2010 IP
  8. dreamconception

    dreamconception Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yes, a relative path is the most easy to handle, instead of full URL. Though I think the actual resource cost difference is pretty much none, if that is your question.
     
    dreamconception, Sep 19, 2010 IP
  9. IDH Media Limited

    IDH Media Limited Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I use the full domain sometimes, depends on what I am using it for and how it is going to be called. Although in terms of being faster and more robust, definatly just the location to the image and not the URL. Each character uses approximately 1 byte of information. So "http://www.google.com/" would use an additional 22 bytes of data....not a lot I know, although if you do this 50 times on a page, that is over 1Kb of abbundant data to load...like I said not a lot, but then again, doesn't hurt optimising that slight bit more...hope this helped!
     
    IDH Media Limited, Sep 19, 2010 IP