More neat php stuff

This page is archived from a static page – some links may not work

I’m feeling quite pleased with myself. I had got the photos up for this months Photo Quest quite quickly, but it could have been a whole lot quicker if I hadn’t been fiddling around with my code.

Essentially, as I do updates now, I am writing in php rather than using the SSI that I had been using before.As a result, the post for Photo Quest needed some re writing to take advantage of the php. Essentially what I did was use the variable that names the page to define the image. I also set variables for the back and forward buttons which was as simple as + 1 and – 1.

Or to put it simpler.. all my images have always been numbers. For example, the images used in this months Photo Quest were 14092.jpg through to 14096.jpg. It was very simple to take this variable and make it go back or forward. As a result I didn’t have as much editing to do as I would have normally had. The middle three images practically wrote themselves.

Having got that working, I spent yesterday evening improving on what I had done. I have used if/else statements to define whether the link is a back (or forward) one image link, or a return to index link. I have also discovered a thing called getimagesize() which means I no longer have to define the image sizes in the tag.

Only one thing needs to be done now and that is to make the server path automatic. Currently if I wanted to move this site to another server (or maybe actually host it under its domain name) I would have to edit the http address manually. From what I can tell, this shouldn’t be too difficult.

Once I am done, I might put the source code up for people who might be interested. (I’m looking at you Flip :P)

This entry was posted in Older posts, Web Design and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *