This is a simple straight-forward PHP class for generating thumbnails. This class will always keep the aspect ratio of your image.
It's also based on GD which on most servers is built in to PHP so there is no need for installing any PHP extensions.
First include the image class, you can do this at the top of your PHP file
require_once("image.php");
Resize an image to a maximum width and height:
$img = new Image("C:\image.png");
$img->resize(120, 120);
$img->save();
Resize an image to a maximum width:
$img = new Image("C:\image.png");
$img->resize(120);
$img->save();
Resize an image to a maximum height:
$img = new Image("C:\image.png");
$img->resize(null, 120);
$img->save();
Save a resized image to another location:
$img = new Image("C:\image.png");
$img->resize(120, 120);
$img->save("C:\image-resized.png");