<?php
function createThumb($realfile) {
	$filename = "images/" . $realfile;
	// Get new sizes
	list($width, $height) = getimagesize($filename);
	$newwidth = 160;
	$newheight = 160;

	// Load
	$thumb = imagecreatetruecolor($newwidth, $newheight);
	$source = imagecreatefromjpeg($filename);

	// Resize
	imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

	// Output
	imagejpeg($thumb, "images/thumb_" . $realfile, 75);
}

function getWidth($filename) {
	list($width, $height) = getimagesize($filename);
	return $width;
}

function getHeight($filename) {
	list($width, $height) = getimagesize($filename);
	return $height;
}
?>