L'ultima parte è così:

codice:
if ($dest_rap == $src_rap) {
	imagecopyresampled($cropped_image_gd , $original_image_gd , 0, 0, 0, 0, $crop_width, $crop_height, $source_width , $source_height );
	} elseif ($dest_rap < $src_rap) {
		$riq_w = $source_height * $dest_rap;
		$source_x = ($source_width - $riq_w) / 2;
		$source_y = 0;
		imagecopyresampled($cropped_image_gd , $original_image_gd , 0, 0, $source_x, $source_y, $crop_width, $crop_height, $riq_w , $source_height );
		} elseif ($dest_rap > $src_rap) {
			$riq_h = $source_width / $dest_rap;
			$source_x = 0;
			$source_y = ($source_height - $riq_h) / 2;
			imagecopyresampled($cropped_image_gd , $original_image_gd , 0, 0, $source_x, $source_y, $crop_width, $crop_height, $source_width , $riq_h );
		}


imagejpeg($cropped_image_gd);

Ti ho evidenziato i parametri che sono sbagliati nella versione precedente!

Ciao