| View previous topic :: View next topic |
| Author |
Message |
nicola.rose
Joined: 04 May 2008 Posts: 3
|
Posted: Sun May 04, 2008 12:27 pm Post subject: Defining Images |
|
|
Sorry if this has already been asked, but I don't really know the technical term for what I need to I don't know what to search for.
Is there a way to kind of 'define' and image by giving it a name, so that anywhere on the page that you type the name, that image will appear?
Basically, I've created a photo album template, but as it involved iframes and thumbnails (and thus multiple links for each picture), I don't want to have to go through changing every link every time I do a new photo album. Instead, I was hoping for something that goes at the top of the page along the lines of
<code here... image 1 src="http://....">
<code here... image 2 src="http://....">
<code here... image 2 src="http://....">
so that the rest of the page could just have <image src="image1"> instead of actual internet addresses - then each time I did a new photo album I could just change the adresses at the top rather than throughout the document.
This probably does exist and there are probably a million tutorials for this already, but as I said I don't know what it would be called so couldn't search it
any help much appreciated!
Thanks |
|
| Back to top |
|
 |
|
|
nicola.rose
Joined: 04 May 2008 Posts: 3
|
Posted: Sun May 04, 2008 11:28 pm Post subject: Re: Defining Images |
|
|
| maybe it's not as simple as I thought... |
|
| Back to top |
|
 |
flabbyrabbit 250+ Club

Joined: 25 Jan 2007 Posts: 494 Location: UK
|
Posted: Sun May 04, 2008 11:42 pm Post subject: Re: Defining Images |
|
|
The easiest way i can see to do this is php.
You could define the links at the top like this:
| Code: |
<?php
$image1 = "http://www.images.com/image1.jpg";
$image2 = "http://www.images.com/image2.jpg";
?> |
Then where you want the image you put for example:
| Code: |
| <img src="<?php echo $image1; ?>"> |
Easy enough??
Flabby Rabbit |
|
| Back to top |
|
 |
nicola.rose
Joined: 04 May 2008 Posts: 3
|
Posted: Sun May 04, 2008 11:55 pm Post subject: Re: Defining Images |
|
|
I'll try it and get back to you on how easy it is...
Thankyou! |
|
| Back to top |
|
 |
dflynn 500+ Club

Joined: 03 Oct 2007 Posts: 505 Location: Guelph, Canada
|
Posted: Mon May 05, 2008 1:39 am Post subject: Re: Defining Images |
|
|
you can use CSS like this:
In you css document:
| Code: |
#img1{
background-image:(url)"http://";
height: 100px;
width: 100px;
etc.
}
|
Then in your HTML:
| Code: |
<a href="put in a link if you want to link the image" id="img1">
|
then you page is full of links that pup up as images.
The only thing about this is that the Height and Width in your CSS has to be the right height and width of the picture or else you could cut it off. so it is useful when all your images are the same dimensons so you can copy paste a lot. |
|
| Back to top |
|
 |
rangana 250+ Club

Joined: 27 Feb 2008 Posts: 439 Location: Cebu City Philippines
|
Posted: Tue May 06, 2008 1:08 am Post subject: Re: Defining Images |
|
|
You could also decide if you want to use client-side (Javascript)...I could create one, but then I'll wait for your response, maybe the two suggestion have suffice your needs  |
|
| Back to top |
|
 |
|