To resize your image, you can use WideImage ( php library for image manipulation ).
It provides easy way to resize your image like:
$image = WideImage::load( 'yourImage.jpg' );
$resizedImage = $image->resize( $width, $height );
You can also save the file after resizing.
$resizedImage->saveToFile( 'filename.jpg' );
For more info, see their documentation.