Use PHP to Center an Image in a DIV

Written by on

I have created a way to always center an image in a DIV container. This has been a thorn in my side as CSS is not my strongest skill.

So here is the concept. Have a container DIV that has a fixed width and height. Then use the GD Library installed with PHP to get the image size that is being displayed inside the DIV. Then subtract the image height from the container height and divide by two. You can do the same for the height.

Simple Jquery Ajax Auto Refreshing DIV

Written by on

So you have a div that you would like to be up to date on your site without having the page refresh?

This small script will allow you do this. Let's say that you want to show the total number of users on your site as your site is blowing up and you want visitors to see the number grow.

Real Time Web Analytics ^