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

A

attorneyatlaw

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.
 
A

Andy Dingley

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.
 
H

htmldummy

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.

:)
 
D

dorayme

htmldummy said:
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"
 
H

htmldummy

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.
 
N

Neredbojias

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.
 
D

Dan

dorayme said:
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.
 
D

dorayme

htmldummy said:
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.
 
D

dorayme

Dan said:
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!).
 
E

Ed Mullen

htmldummy said:
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?
 
H

htmldummy

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.
 
J

Jose

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
 
B

Beauregard T. Shagnasty

htmldummy said:
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.
 
E

Ed Mullen

Beauregard said:
Ahh. Now we're getting somewhere. The real reason.



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! ;-)
 
B

Beauregard T. Shagnasty

Ed said:
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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top