The following PHP code is some code I use on this blog that I thought some others that don’t program may find useful. What it does is assign an image to each unique post ID from WordPress that is a gif file. If you put a file in the image folder in your root directory of your Website called 8.gif – the 8th post you made on your blog will be assigned that image wherever you place this code. If there is no image for that id (you haven’t put a file called 8.gif in yet) it assigns the image called uplogo.gif. Of course you can change any of the directories, file extensions, and the alternative image name to suit your own needs.You can find the post ID by looking in manage posts from your dash. You should use this code in template files.
$image = "$id.gif";
echo "<img src='/images/$image' alt='alt tag' />";
echo "<img src='/images/uplogo.gif' alt='alt tag' />";
It’s quite a difficult task to find clean, crisp, relevant, yet legal images to use on a Website. If you understand what copyright is you will know that you can’t just grab any old image you see on the web and place it on your own site. So where do you get images from? Stock photography is the answer for many web designers – well those that aren’t the sort that carry around a digital SLR in their bag anyway. The problem here for most small sites is that a good stock image doesn’t come cheap, and I hear you saying…”why pay when I can just download free images from the net”. Good question. To get to the point, your main concern here should be legality. I am certainly not going to trust any old “Free Clip-art download site” where you don’t so much as even see a legal notice or licence for the image you are getting. However I have found a few sources of free legal downloads of stock images where the licensing of the images is very clear. These photos are sometimes referred to as public domain images.
Free Stock Image sites:
SXC <- Has many free images, with some extra sharp premium paid images which cost.
Morgue File <- All free, a good source for images.
Dreamstime <- Has some free images, mostly pay images.
Image After <- All free images.
Vecteezy <- Very cool site with some free vector images, and sorted by licence type (source of bikini image above).
Good luck pic hunting.