PHP GD - resizing image frame/canvas but not the actual image

The correct method is to create a new image and then copy the old image into the middle of it (assuming the starting image is is a JPEG and smaller than 100x100):

$oldimage = imagecreatefromjpeg($filename);
$oldw = imagesx($oldimage);
$oldh = imagesy($oldimage);

$newimage = imagecreatetruecolor(100, 100); // Creates a black image

// Fill it with white (optional)
$white = imagecolorallocate($newimage, 255, 255, 255);
imagefill($newimage, 0, 0, $white);

imagecopy($newimage, $oldimage, (100-$oldw)/2, (100-$oldh)/2, 0, 0, $oldw, $oldh);

You can see here: Thumbnail generation with PHP tutorial