PHP HTML Table Class

Written by on
So like most programmers, I do not like to have to replicate code or write the same HTML structures over and over again. This is a PHP Class that allows you to write HTML Tables without writing a single line of HTML.

Static Website Template Engine

Written by on

I have made some static webpages recently and I have been meaning to make an extremely simple template engine that will drive these sites.  I always have a library of functions for getting html headers, footers and common functions, but I didn't have the template portion.  Here is a very easy to implement system that allows you to make static websites that do not need databases that load very fast.  It basically lets you define a set of pages and then will automatically serve the correct page from a folder.  This is instead of having to make new folders and index files for each new page.

Resize Image on the Fly to Fit in a Square Box

Written by on

This simple image class will allow you to get an image from your server to dynamically resize it and center it top/bottom and left/right in a square box. If you have some images that are all good kb size but are a bit random in their dimensions, you can use this class to make them fit dynamically in a box. It will make images that are larger than the bounds of the box smaller, but will not adjust the size of images that are smaller than then bounds. That would make them blurry, so instead it just makes them centered in the box.

I am using this in a scenario where there are images that have been uploaded to the server that are very small 200x200 and rather large 1000x1200. The size of my display box in this example is 400x400.

Here is a demo: http://www.matthewaprice.com/image-resize-demo/

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 Regular Expression Removal Class

Written by on

I have written a simple php class that handles regular expressions. Once instantiated it can remove characters, numbers, words, letter, or custom expressions from a string. It does not require you to know any of the syntax for implementation. It simply returns the value of the string with the pattern removed.

Commonly Used Time Arrays

Written by on

So i have these commonly used arrays for