Setting the src location only 1 time in the beginning for ALL graphics??

Discussion in 'HTML' started by attorneyatlaw@hotmail.com, Mar 27, 2006.

  1. Guest

    Boy... If somebody could help me solve this, I'd certainly appreciate
    it.

    Long story short, I have a website. I have a TON of graphics.
    However, the graphics are stored someplace other than the website (i.e.
    similar to when you put an ad on Ebay and store the graphics for your
    ad someplace else). So basically I have a ton of html coding with
    something like:

    src="http://home.att.net/~novice/beginner/homepage/me/pic1.jpg"
    src="http://home.att.net/~novice/beginner/homepage/me/pic2.jpg"
    src="http://home.att.net/~novice/beginner/homepage/me/pic3.jpg"
    src="http://home.att.net/~novice/beginner/homepage/me/pic4.jpg"
    src="http://home.att.net/~novice/beginner/homepage/me/pic5.jpg"
    src="http://home.att.net/~novice/beginner/homepage/me/pic6.jpg"
    src="http://home.att.net/~novice/beginner/homepage/me/pic7.jpg"

    Is there a way to add ONE line in the beginning of the html document
    telling the computer that ALL graphics will be stored at:
    http://home.att.net/~novice/beginner/homepage/me/"

    So that my html coding will instead look like this (since it will
    already know where ALL of the graphics are stored):
    src="pic1.jpg"
    src="pic2.jpg"
    src="pic3.jpg"
    src="pic4.jpg"
    src="pic5.jpg"
    src="pic6.jpg"
    src="pic7.jpg"

    I hope you can help.. this would save me a TON of
    repetition/typing/confusion. Thanks greatly in advance.
     
    , Mar 27, 2006
    #1
    1. Advertising

  2. Andy Dingley Guest

    wrote:

    > Is there a way to add ONE line in the beginning of the html document
    > telling the computer that ALL graphics will be stored at:
    > http://home.att.net/~novice/beginner/homepage/me/"


    No.

    There might be, if you'd set the initial HTML up to use relative links
    then you could use <base> to control the mapping of relative =>
    absolute. However this is always rather confusing and it won't work if
    you've set the link paths up as full absolute urls to begin with.

    What you should do is to find yourself a nice powerful editor, with
    good search and replace - including multi-file search and replace. With
    something like TextPad (downloadable, free trial mode, cheap to buy)
    then you can do this properly and in seconds.

    Also consider not using full paths in the future. If a simple relative
    path gets you from page to image (most simple images on most simple
    pages) then you can and should use that instead.
     
    Andy Dingley, Mar 27, 2006
    #2
    1. Advertising

  3. htmldummy Guest

    Can you give me an example of what EXACTLY to search and replace? I'm
    new at this.

    Or better yet, a very short/simply example of a webpage with a single
    graphic that does not uses your <base> command instead.

    Thanks GREATLY in advance.

    :)
     
    htmldummy, Mar 27, 2006
    #3
  4. wrote:

    > I hope you can help.. this would save me a TON of
    > repetition/typing/confusion. Thanks greatly in advance.


    Copy and paste should save you the repetition.

    Highlight by sweeping with mouse:
    http://home.att.net/~novice/beginner/homepage/me/pic
    Press Control-C
    Place insertion point at next location.
    Press Control-V
    Type <number>.jpg

    --
    -bts
    -Warning: I brake for lawn deer
     
    Beauregard T. Shagnasty, Mar 27, 2006
    #4
  5. dorayme Guest

    In article
    <>,
    "htmldummy" <> wrote:

    > Can you give me an example of what EXACTLY to search and replace? I'm
    > new at this.
    >
    > Or better yet, a very short/simply example of a webpage with a single
    > graphic that does not uses your <base> command instead.
    >
    > Thanks GREATLY in advance.
    >
    > :)


    I will assume you have a capable text editor with at least basic
    search and replace features over multiple documents (eg, all the
    docs in some folder). Here is a big time saver:

    When you type in your links, to use the examples you gave,

    src="http://home.att.net/~novice/beginner/homepage/me/pic1.jpg"
    src="http://home.att.net/~novice/beginner/homepage/me/pic2.jpg"

    type instead:

    src="/pic1.jpg"
    src="/pic2.jpg"

    and then search "/pic" and replace all with
    "http://home.att.net/~novice/beginner/homepage/me/pic"

    (The quotes and the blue are just to communicate with you here).

    Don't read on if the above helps you fine.

    There is a more sophisticated search and replace you can use if
    there are problems using the above. You did say that all your pic
    links were like this. If they were not, or if you wanted to avoid
    replacing all such text, then when you are composing your source,
    just type some unlikely character in the places you will change
    later: eg. src="*/pic1.jpg" and then do a S and R on "*/pic". The
    idea here being that typing * as you go is easier than the
    fingerful of "http://home.att.net/~novice/beginner/homepage/me"

    --
    dorayme
     
    dorayme, Mar 27, 2006
    #5
  6. htmldummy Guest

    No... sorry... its a bit more complex. I know how to search/replace.
    I know how to copy/paste. The problem is I need to replace as many
    characters as possible. Basically, there is a character limitation.
    Therefore, I need to shorten the length of the html coding. The
    easiest way to do this is to replace 999 of these
    "http://home.att.net/~novice/beginner/homepage/pic1.jpg" with instead
    these "pic1.jpg."

    Therefore... if anybody knows how to tell the html page where ALL of
    the pics are stored, instead of having to retype it, I'd be most
    appreciative.

    I apologize for the confusion.
     
    htmldummy, Mar 28, 2006
    #6
  7. Neredbojias Guest

    With neither quill nor qualm, htmldummy quothed:

    > No... sorry... its a bit more complex. I know how to search/replace.
    > I know how to copy/paste. The problem is I need to replace as many
    > characters as possible. Basically, there is a character limitation.
    > Therefore, I need to shorten the length of the html coding. The
    > easiest way to do this is to replace 999 of these
    > "http://home.att.net/~novice/beginner/homepage/pic1.jpg" with instead
    > these "pic1.jpg."
    >
    > Therefore... if anybody knows how to tell the html page where ALL of
    > the pics are stored, instead of having to retype it, I'd be most
    > appreciative.
    >
    > I apologize for the confusion.


    Using "base href" is probably what you want, but if you have other
    links, that could be a difficulty.

    --
    Neredbojias
    Contrary to popular belief, it is believable.
     
    Neredbojias, Mar 28, 2006
    #7
  8. Dan Guest

    dorayme wrote:
    > When you type in your links, to use the examples you gave,
    >
    > src="http://home.att.net/~novice/beginner/homepage/me/pic1.jpg"
    > src="http://home.att.net/~novice/beginner/homepage/me/pic2.jpg"
    >
    > type instead:
    >
    > src="/pic1.jpg"
    > src="/pic2.jpg"
    >
    > and then search "/pic" and replace all with
    > "http://home.att.net/~novice/beginner/homepage/me/pic"


    That isn't going to work. With the leading slash in the "src"
    references, they will be relative to the root of the given hostname, at
    http://home.att.net/pic1.jpg, etc., which isn't what the original
    poster wanted. The correct values are:

    base href="http://home.att.net/~novice/beginner/homepage/me/"

    img src="pic1.jpg", etc.

    --
    Dan
     
    Dan, Mar 28, 2006
    #8
  9. dorayme Guest

    In article
    <>,
    "htmldummy" <> wrote:

    > No... sorry... its a bit more complex. I know how to search/replace.
    > I know how to copy/paste. The problem is I need to replace as many
    > characters as possible. Basically, there is a character limitation.
    > Therefore, I need to shorten the length of the html coding. The
    > easiest way to do this is to replace 999 of these
    > "http://home.att.net/~novice/beginner/homepage/pic1.jpg" with instead
    > these "pic1.jpg."
    >
    > Therefore... if anybody knows how to tell the html page where ALL of
    > the pics are stored, instead of having to retype it, I'd be most
    > appreciative.
    >
    > I apologize for the confusion.


    What are you replying to? Please quote the relevant bits.

    I gave you a plan. In it, you do not copy and paste anything.
    You instruct the Search and Replace software to do this. It
    happens automatically, to all the files in any folder you
    specify.

    I understood you to want all your "/pic..." preceded by
    src="http://home.att.net/~novice/beginner/homepage/me/

    So if you do what I said when creating the html entries, you
    later then auto replace all instances to get what you want.

    What do you mean you have to replace as many characters as
    possible?

    What is going on? Have you already done the work and it is all in
    absolute url references and you want to now change it to be
    shorter and neater? Or do you want to save yourself trouble and
    do it simple from now on? Either way, I thought I had covered the
    situation?

    Do you know about Search and Replace over a folder of files? if
    not, then this may need to be explained further.

    --
    dorayme
     
    dorayme, Mar 28, 2006
    #9
  10. dorayme Guest

    In article
    <>,
    "Dan" <> wrote:

    > dorayme wrote:
    > > When you type in your links, to use the examples you gave,
    > >
    > > src="http://home.att.net/~novice/beginner/homepage/me/pic1.jpg"
    > > src="http://home.att.net/~novice/beginner/homepage/me/pic2.jpg"
    > >
    > > type instead:
    > >
    > > src="/pic1.jpg"
    > > src="/pic2.jpg"
    > >
    > > and then search "/pic" and replace all with
    > > "http://home.att.net/~novice/beginner/homepage/me/pic"

    >
    > That isn't going to work. With the leading slash in the "src"
    > references, they will be relative to the root of the given hostname, at
    > http://home.att.net/pic1.jpg, etc., which isn't what the original
    > poster wanted. The correct values are:
    >
    > base href="http://home.att.net/~novice/beginner/homepage/me/"
    >
    > img src="pic1.jpg", etc.


    Perhaps I have misunderstood him or you? I was assuming other
    posts (like Andy Dingly's) were right and it could not quite be
    done as OP imagined. I was giving a method to write up the files
    without having to type and copy paste every link as he builds the
    site. I still do not understand why it would not work from your
    remarks - perhaps you are misunderstanding me? Surely he ends up
    with all the absolute url references in his final code and they
    will be fine (not elegant, true!).

    --
    dorayme
     
    dorayme, Mar 28, 2006
    #10
  11. Ed Mullen Guest

    Re: Setting the src location only 1 time in the beginning for ALLgraphics??

    htmldummy wrote:
    > No... sorry... its a bit more complex. I know how to search/replace.
    > I know how to copy/paste. The problem is I need to replace as many
    > characters as possible. Basically, there is a character limitation.


    Please define "character limitation." You seem to be saying you can't
    use search and replace because the resulting URLs are too long. Too
    long for what? Why?

    > Therefore, I need to shorten the length of the html coding. The
    > easiest way to do this is to replace 999 of these
    > "http://home.att.net/~novice/beginner/homepage/pic1.jpg" with instead
    > these "pic1.jpg."
    >
    > Therefore... if anybody knows how to tell the html page where ALL of
    > the pics are stored, instead of having to retype it, I'd be most
    > appreciative.
    >
    > I apologize for the confusion.
    >



    --
    Ed Mullen
    http://edmullen.net
    http://mozilla.edmullen.net
    http://abington.edmullen.net
     
    Ed Mullen, Mar 28, 2006
    #11
  12. htmldummy Guest

    What I mean by character limitation is this:

    Craig's list, for example, only allows 3,000 characters to be posted in
    the ad (i.e. a total of 3,000 letters, characters, spaces).
    Therefore, because I have a ton of graphics
    (i.e."http://home.att.net/~novice/beginner/homepage/pic1.jpg"), those
    take up a lot of the characters.

    So for example:
    http://www.home.att.net/pic.jpg <- 34 characters.

    Hope that explains it better.

    In other words, I have a html document created. I need to reduce the
    size of the chracters used. The easiest way to do this is to replace:
    http://home.att.net/~novice/beginner/homepage/pic1.jpg
    with:
    pic.jpg
    if possible... that would save me a TON of characters.
     
    htmldummy, Mar 28, 2006
    #12
  13. Jose Guest

    Re: Setting the src location only 1 time in the beginning for ALLgraphics??

    The simple way to shrink the url size for pictures is to put all the
    pictures in a subdirectory of your site (a subdirectory off the
    directory in which the referring page lives). Then you can use relative
    URLs. For example
    href=images/pic1.jpg
    would refer to pic1.jpg, stored in the images folder of your site.

    You could dump all the pictures in the root of your site, letting you use
    href=pic1.jpg
    but that gets messy.

    Jose
    --
    Nothing takes longer than a shortcut.
    for Email, make the obvious change in the address.
     
    Jose, Mar 28, 2006
    #13
  14. htmldummy wrote:

    > What I mean by character limitation is this:
    >
    > Craig's list, for example, only allows 3,000 characters to be posted
    > in the ad (i.e. a total of 3,000 letters, characters, spaces).
    > Therefore, because I have a ton of graphics
    > (i.e."http://home.att.net/~novice/beginner/homepage/pic1.jpg"), those
    > take up a lot of the characters.


    Ahh. Now we're getting somewhere. The real reason.

    > So for example: http://www.home.att.net/pic.jpg <- 34 characters.
    >
    > Hope that explains it better.
    >
    > In other words, I have a html document created. I need to reduce the
    > size of the chracters used. The easiest way to do this is to
    > replace: http://home.att.net/~novice/beginner/homepage/pic1.jpg
    > with:
    > pic.jpg
    > if possible... that would save me a TON of characters.



    No, you can't use just 'pic.jpg' on the craiglist server, as it would
    look for pic.jpg in its own root directory. You need the fully-qualified
    URL for your own server.

    You can same some bytes by putting them in your *own* root directory.

    http://novice.home.att.net/pic.jpg

    but that is going to be your least amount of bytes. Assuming 'novice'
    is not your real email id, make sure you choose a short word.

    --
    -bts
    -Warning: I brake for lawn deer
     
    Beauregard T. Shagnasty, Mar 28, 2006
    #14
  15. Ed Mullen Guest

    Re: Setting the src location only 1 time in the beginning for ALLgraphics??

    Beauregard T. Shagnasty wrote:
    > htmldummy wrote:
    >
    >> What I mean by character limitation is this:
    >>
    >> Craig's list, for example, only allows 3,000 characters to be posted
    >> in the ad (i.e. a total of 3,000 letters, characters, spaces).
    >> Therefore, because I have a ton of graphics
    >> (i.e."http://home.att.net/~novice/beginner/homepage/pic1.jpg"), those
    >> take up a lot of the characters.

    >
    > Ahh. Now we're getting somewhere. The real reason.
    >
    >> So for example: http://www.home.att.net/pic.jpg <- 34 characters.
    >>
    >> Hope that explains it better.
    >>
    >> In other words, I have a html document created. I need to reduce the
    >> size of the chracters used. The easiest way to do this is to
    >> replace: http://home.att.net/~novice/beginner/homepage/pic1.jpg
    >> with:
    >> pic.jpg
    >> if possible... that would save me a TON of characters.

    >
    >
    > No, you can't use just 'pic.jpg' on the craiglist server, as it would
    > look for pic.jpg in its own root directory. You need the fully-qualified
    > URL for your own server.
    >
    > You can same some bytes by putting them in your *own* root directory.
    >
    > http://novice.home.att.net/pic.jpg
    >
    > but that is going to be your least amount of bytes. Assuming 'novice'
    > is not your real email id, make sure you choose a short word.
    >


    all of that ... or ... you could post a single link on Craig's List that
    goes to a single page on YOUR server that has thumbnails of all the
    images which, when clicked on, load the full images. Of course, without
    a really clear picture of what you're trying to do, or of how Craig's
    List works, well, I'm just shooting in the dark here! ;-)

    --
    Ed Mullen
    http://edmullen.net
    http://mozilla.edmullen.net
    http://abington.edmullen.net
     
    Ed Mullen, Mar 29, 2006
    #15
  16. Ed Mullen wrote:

    > Of course, without a really clear picture of what you're trying to do,
    > or of how Craig's List works, well, I'm just shooting in the dark
    > here! ;-)


    True. I went and had a look at craigslist, and it seems to be about a
    billion want ads with misspelled words and a lot of bad grammar. <g>

    --
    -bts
    -Warning: I brake for lawn deer
     
    Beauregard T. Shagnasty, Mar 29, 2006
    #16
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Richter

    <txt src= ...> equivalent of <img src= ...>

    Steve Richter, Feb 8, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,185
    Laurent Bugnion
    Feb 9, 2006
  2. Greg Johnson
    Replies:
    4
    Views:
    3,142
  3. Replies:
    1
    Views:
    1,674
    Alex Hunsley
    Mar 23, 2007
  4. Jesse B.
    Replies:
    9
    Views:
    260
    Jesse B.
    Mar 27, 2010
  5. Soren Vejrum
    Replies:
    4
    Views:
    763
    Lasse Reichstein Nielsen
    Jul 5, 2003
Loading...

Share This Page