Help with image display

i have this code that take a given image and resize it and must display it. Every thing seems to work fine (no warning until now). But when comes the time to display the image it only appera unreadeble text whith strange characters
here is the code

$filename = ‘pic.jpg’;
// Defining the maximum width and maximumm height
$width = 200;
$height = 200;
// Content type
header(‘Content-type: image/jpeg’);
// Calculating the new width & the new height
list($width_orig, $height_orig) = getimagesize($filename);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
// Resizing the image
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Display the resized image
imagejpeg($image_p, null, 100);

How can i fix it?