# Help with image display

**URL:** <https://forum.kirupa.com/t/help-with-image-display/237178>\
**Category:** Uncategorized\
**Created:** [August 27, 2007, 9:40pm UTC](https://forum.kirupa.com/t/help-with-image-display/237178 "2007-08-27T21:40:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wo1olf](https://avatars.discourse-cdn.com/v4/letter/w/278dde/32.png) [@wo1olf](https://forum.kirupa.com/u/wo1olf)\
**Post date:** [August 27, 2007, 9:40pm UTC](https://forum.kirupa.com/t/help-with-image-display/237178/1 "2007-08-27T21:40:28Z")

</div>

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?
