Images
Basic Images
To display any image on your page, you first have to upload it to the internet. Uploading means you store a copy of it on a large, always-on
computer called a server, or host, so that other people can access it (they cannot access files stored on your computer!).
Of course, if you're building a full website, you'll already know all this, and you can upload your images to the same place as your web
pages. If however you're just decorating a profile or blog, you're going to need a free host to store your images on. There are plenty of ad
supported hosts you can use like [ Tinypic ] and
[ Photobucket ]. Uploading to these hosts is quite
simple. You click browse, locate the image on your computer, and click Upload. Then they will provide you with a path to where your image is
stored, usually called a Link or an Url.
On Tinypic the url will look like this:

and you want to copy the bottom code, called the "Direct Link".
If you prefer to use Photobucket to store your images, you will need to create an account before you can upload anything, and again you'll be
shown browse and upload buttons. Once your image is uploaded you'll need to scroll down to see it, and it'll look like this:
Again the one you want to copy is called the "Direct Link".
Nb, If you have your own site the url will be http://www.mysite.com/folder/imagename (don't forget the image extension- gif, jpg, png etc).
Once you have your Link or Url, you display the image on your page by pasting that link into an image tag, like this:
<img src="http://your image url here.gif">
[ Click Here ] for more help with free image hosts.

Making Image Links
This is the code to make your own clickable image.
You must use the full path of the page you want to link to (ie including the http:// bit), unless it's a part of the same site you're
linking from.
<a href="http://www.page to link to.com"><img src="http://your image url here.gif"></a>
Open In a New Window
If you want your link to open in a new window when someone clicks on it, just include target="_blank" in the link tag (the "a href" part),
like this:
<a href="http://www.page to link to.com" target="_blank">
<img src="http://your image url here.gif"></a>
No Borders?
Image links usually have a border by default. If you dont want a border on your image, add border="0" to the image tag like this:
<a href="http://www.page to link to.com">
<img src="http://your image url here.gif" border="0"></a>

Resizing Images
It's better to resize your images in a program like Photoshop or Paintshop before you upload them if you can, as resizing
with code reduces image quality.
If you absolutely have to resize an image with code, there are 2 methods available to you. If you are writing the image tag into
your page yourself, you can just include your desired width (and / or height) inside it, either with html:
<img src="http://your image url here.gif" width="100px" height="150px">
Or with css:
<img src="http://your image url here.gif" style="width: 100px; height: 150px;">
Alternatively, if your image is inaccessible but has a class (often the case on profile / blog sites), or even if you just want to keep
things tidy by setting your sizes in a separate style sheet, you can set your image width and height in a separate piece of css, linked
to the image by its class. The image tag would have to look something like:
<img src="http://your image url here.gif" class="myimage">
(class name can be anything), and then the css you would need to add is:
<style type="text/css">
.myimage {
width: 100px;
height: 150px;
}
</style>
Size is measured in px (pixels). One pixel is tiny- about the size of a full stop.

Alternative Text
Alts let you include some alternative text for if the image doesn't load. If your visitors are using Internet Explorer
the text pops up on mouseover too. Alt tags are used to give the visitor some information about your image, and its good practice
to include them if you can. In XHTML, Alt tags are required on all images, or your page won't validate.
Move your mouse of the image on the left (Explorer users only) to see the alternative text pop up. The image on the
right is what would show up if the image failed to load.
To include an alt, just add it to your image tag:
<img src="http://your image url here.gif" alt="Your Alternative Text">

Image Borders
With the joys of CSS, not only can you put borders around your static images, but also borders around image links that change style, size
or color on mouseover! (check out the [ Mouseover ] bit for more on that) For now lets
keep it simple- to put a border around a static image, you can put the border style directly into it's tag:
<img src="http://your image url here.gif" style="border: 1px solid deeppink;">
Or alternatively if your image has a class (or you can give it one) like this:
<img src="http://your image url here.gif" class="myimage">
(class name can be anything), you can give it a border using a separate style sheet, like this:
<style type="text/css">
.myimage { border: 1px solid deeppink; }
</style>

Mouseover Images
(Aka how to make your images change when someone moves their mouse over them). These methods of creating mouseover images rely on your
images being inside a link. Your link doesn't necessarily have to point to anywhere- you'll notice that the instead of a href="path to page",
the examples below contain a href="#", which is a link that doesn't go anywhere, but the link tag is essential for these mouseovers to function.
Mouseover Image Swaps
As with so many things in life, there's a couple of ways of doing this. If you're building your own site you may want to use Javascript,
whereas if you're working on a blog or profiling site, chances are they won't let you use it, and you'll need to use the CSS method.
The Javascript Method
You will need: 2 images, which have the same width and height (as each other). Let's say the one you want to show up all the time is called
mainimage1.gif, and the one you want to appear when someone rolls their mouse over mainimage1 is called mouseover1.gif. We can use Javascripts
onmouseover and onmouseout methods to do a straight swap:
<a href="#" onMouseOver="document.image1.src='mouseover1.gif'"
onMouseOut="document.image1.src='mainimage1.gif'">
<img src="mainimage1.gif" name="image1"></a>
And that's it. If you want to swap multiple different images on the same page (for example on a navigation bar) you can give each one a different
name (ie image2, image3 image4 etc).
The CSS Method
As with the Javascript version, you need 2 images the same size. Let's call the main image mainimage1.gif, and the one to show on mouseover mouseover1.gif.
Then all you need to do is make the link block level so it can have a width and height, and set those dimensions to the size of the images, eg:
<style type="text/css">
.hoverlink { display: block; width: 100px; height: 100px; }
a.hoverlink:link, a.hoverlink:visited { background: url('http://path to mainimage1.gif'); }
a.hoverlink:hover { background: url('http://path to mouseover1.gif'); }
</style>
<a href="#" class="hoverlink"></a>
Don't forget you must upload your images to the internet, and use full paths (including the http:// bit) if they are not being
stored on the same site as the page you're working on. [ More on Image Hosts ]
Filters on Mouseover
You can add a [ filter ] (shows up in IE only) or [ Opacity ]
to your images, and have it change on mouseover. Go to those sections for how to apply the different filters. I'm going to use opacity as an example,
because it works in most browsers.
The code for this one is simple CSS. You must give your image a class (or if you're working on o profile / blog site it may already have one)
and then set the opacity in your style sheet, like this:
<a href="#"><img src="http://www.path to your image.gif" class="myimage"></a>
<style type="text/css">
a.:link .myimage, a:visited .myimage { filter: alpha(opacity=1); -moz-opacity: 1; opacity: 1; }
a:hover .myimage { filter: alpha(opacity=60); -moz-opacity:.60; opacity:.60; }
</style>
Image Size On Mouseover
You can make your images grow like this:
<a href="#"><img src="http://www.path to your image.gif" class="myimage"></a>
<style type="text/css">
a.:link .myimage, a:visited .myimage { width: 100px; height: 100px; }
a:hover .myimage { width: 200px; height: 200px; }
</style>
Changing Borders On Mouseover
<a href="#"><img src="http://www.path to your image.gif" class="myimage"></a>
<style type="text/css">
a.:link .myimage, a:visited .myimage { border: 3px double red; }
a:hover .myimage { border: 5px solid lime; }

Opacity/Transparency
This code works in (at least) IE, Firefox and newer versions of Opera. It may work in other browsers too. If you want
fade in or out effects IE has a specific filter for that: [ Fade Filter ], but it won't work in any
browsers other than Internet Explorer. Of course you can always replace the alpha(opacity=xx) part of this code with a fade in/
out filter for Explorer, and set moz-opacity as well for other browsers. Opacity (in case you're wondering) is simply the
opposite to transparency. 100% Opaque is completely visible, while 100% transparent is completely invisible. Anyhow, on with
the filter.
 |
 |
 |
| 50% Opaque Image |
75% Opaque Image |
100% Opaque Image |
Here's an example of 50% opacity applied to an image by writing the code directly into the image tag:
<img src="http://www.path to your image.gif" style="filter: alpha(opacity=50); -moz-opacity:.50; opacity:.50;">
Alternatively you can give your image a class (or in the case of profile / blog sites it may already have one) and add your styles in a
separate style sheet:
<img src="http://www.path to your image.gif" class="myimage">
<style type="text/css">
.myimage { filter: alpha(opacity=50); -moz-opacity:.50; opacity:.50; }
</style>
Nb. Opacity works on text too. [ Text Opacity ]

Other Filters (IE only)
You can use filters on images, animated images and even text. (See the [ text bit ]
for an explanation of applying filters to text). Filters are exclusive to the Internet Explorer browser, so people using other
browsers will just see the original image.
You can apply image filters to any or all of the pictures on your page, either by writing the filter code directly into the image tag,
or using CSS to define which image(s) the filter will affect. The codes below use the fliph (horizontal flip filter) as an example
of different ways to apply the filter. You can change fliph for any of the filters further down the page to use a different filter.
To apply the filter to every single image on your page:
<style type="text/css">
img, a:link img, a:visited img, a:hover img { filter: fliph; }
</style>
Just static images (ones that aren't clickable links)
<style type="text/css">
img { filter: fliph; }
</style>
Just image links (not static images)
<style type="text/css">
a:link img, a:visited img, a:hover img { filter: fliph; }
</style>
Just image links when they're NOT being moused over
<style type="text/css">
a:link img, a:visited img { filter: fliph; }
</style>
Just image links when they ARE being moused over
<style type="text/css">
a:hover img { filter: fliph; }
</style>
One particular image (using a class)
<img src="http://www.path to your image.gif" class="myimage">
<style type="text/css">
.myimage { filter: fliph; }
</style>
One particular image (by adding styles directly into its tag)
<img src="http://www.path to your image.gif" style="filter: fliph;">
And now the filters...
Fade Filter (IE Only)
Xray Filter (IE Only)
filter: xray; |
 |
 |
Blur Filter (IE Only)
filter: blur; |
 |
 |
Horizontal Flip Filter (IE Only)
filter: fliph; |
 |
 |
Vertical Flip Filter (IE Only)
filter: flipv; |
 |
 |
Gray Filter (IE Only)
filter: gray; |
 |
 |
Invert Filter (IE Only)
filter: invert; |
 |
 |
Wave Filter (IE Only)
filter: wave; |
 |
 |

Hosts / Upload Help
Uploading an image means that you put it on the internet so anyone can access it at any time, even if your computer is
turned off. There are lots of ad supported sites that will let you host your images for free.
Tinypic [ www.tinypic.com ]
Tinypic is possibly the simplest image host ever. You simply click "Browse" find the file on your computer you want to
upload, and press "Upload":
When you're done, it spits out 4 links like this:
You want the bottom one. The "Direct Link For Layouts". Then all you do to put the image on your page copy the link and paste
it into an image tag, like this:
<img src="http://i9.tinypic.com/6u98iea.jpg">
Although tinypic is good for hosting the odd image, it has its drawbacks- if you loose an url you cant get it back
and you have to start over, and you cant delete your images.
Photobucket [ www.photobucket.com ]
Photobucket is a little more complicated, requiring you to sign up and log in before you can start to upload your pictures.
(Press the red "Join Now" button on the top right of the page to create an account).
On the plus side, it does have the benefit of allowing you to edit delete and organize your images, and upload several at once.
When you've signed up and logged in you get an interface similar to tinypic- browse and upload buttons. Once the image has
uploaded you're returned to the same page, except with an orange box telling you your images were uploaded successfully. Then you
have to scroll down to get the url. Each one has 4 links (again like Tinypic), and again you want the "Direct Link", this time it's
the second one down.
<img src="http://i72.photobucket.com/albums/i170/ElectroGenius/monkey.gif">
Imageshack [ www.imageshack.us ]
Imageshack is a bit over complicated looking, but again theres only 2 buttons you need to pay attention to- "Browse" and "Host It".
At first glance it looks like an email address is required, but as with Tinypic you don't actually need to create an account to upload,
so if you don't want to just leave the email field blank.
When you've uploaded your picture you're faced with a whole bunch of urls most of which are in BBCode, and this time none of them
are a direct link. What you do have however is a thumbnail code, which is ideal if your image is large and you want people to see a small
version then click for full. If you're happy with that all you need to do is take the top code, the "Thumbnail For Websites" and paste it
into your page exactly as it is:
If this isn't what you're after and you want to display the full image, what you need to do instead of selecting a link from that page,
is click ON the image:
Which will take you to a new page with the big version of your image on. Then scroll down, and you'll see another box of links like this:
And there right at the bottom is your direct link. As with the hosts above you can just take this direct link and paste it into your
image tag, like so:
<img src="http://img413.imageshack.us/img413/3908/monkeyuo7.gif">
Then paste the image tag into your page.
How to use Free Hosts
Most other image hosts work similarly to the ones above. You can generally find the url you want by looking for the one that starts with
"http://" and ends with some image extension- usually .jpg, .gif or .png. It's often called the link, url, or direct link.
You want to avoid any codes these sites give you that contain BBCode (that is codes in square tags like this [img]http://blah.gif[/img])
because BBCode is for messageboards and will not work on your own website or most profiles / blogs.
If you copy "HTML tags" off these sites rather than the link or url, they should work, but it will usually make your image a clickable link
back to that hosting site. If you don't want that to happen its better to create your own image tag by pasting the plain url or link (that
is the one that starts http:// and ends in an image extension) into an image tag, like this:
<img src="http://www.path to your image.gif">
Other Free Image Hosts

|