Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Setting the src location only 1 time in the beginning for ALL graphics??

Reply
Thread Tools

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

 
 
attorneyatlaw@hotmail.com
Guest
Posts: n/a
 
      03-27-2006
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.

 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      03-27-2006

http://www.velocityreviews.com/forums/(E-Mail Removed) 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.

 
Reply With Quote
 
 
 
 
htmldummy
Guest
Posts: n/a
 
      03-27-2006
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.



 
Reply With Quote
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      03-27-2006
(E-Mail Removed) 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
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      03-27-2006
In article
<(E-Mail Removed). com>,
"htmldummy" <(E-Mail Removed)> 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
 
Reply With Quote
 
htmldummy
Guest
Posts: n/a
 
      03-28-2006
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.

 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      03-28-2006
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.
 
Reply With Quote
 
Dan
Guest
Posts: n/a
 
      03-28-2006

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

 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      03-28-2006
In article
<(E-Mail Removed) .com>,
"htmldummy" <(E-Mail Removed)> 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
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      03-28-2006
In article
<(E-Mail Removed) .com>,
"Dan" <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
index of string from beginning of line vs beginning of file Jesse B. Ruby 9 03-27-2010 04:04 PM
Location, location, location =?Utf-8?B?VHJhY2V5?= Wireless Networking 2 02-17-2007 08:37 PM
<txt src= ...> equivalent of <img src= ...> Steve Richter ASP .Net 3 02-09-2006 08:44 PM
src.jar (src.zip) missing on Mac OSX Java 1.4.1 installation? Greg Johnson Java 4 09-18-2003 07:21 AM
Problem: Setting MSIE iframe innerHTML change relative href/src to absolute href/src Soren Vejrum Javascript 4 07-05-2003 01:47 PM



Advertisments