imagecopy is the function you need
crop image example:
<?php
// Create image instances
$src = imagecreatefromgif('php.gif');
$dest = imagecreatetruecolor(80, 40);
// Copy
imagecopy($dest, $src, 0, 0, 20, 13, 80, 40);
// Output and free from memory
header('Content-Type: image/gif');
imagegif($dest);
imagedestroy($dest);
imagedestroy($src);
?>
if you just need to add a white background imagefill is your function:
$image = imagecreatetruecolor(100, 100);
// set background to white
$white = imagecolorallocate($im, 255, 255, 255);
imagefill($image, 0, 0, $white);