高手帮个忙嘛!图片不能显示的问题!

高手帮个忙嘛!图片不能显示的问题!

独立的代码可以显示出来,但是我整合到我的网页中就出现了错误!
程序中可以获得一个参数$fname然后下面就include("tt.php")用于显示图片的缩阅图。
tt.php 这个代码独立用的时候都是对的,可是包含进去的时候就出错了。
<?php
# Constants
define(IMAGE_BASE, 'upfile/images/');
define(MAX_WIDTH, 150);
define(MAX_HEIGHT, 150);

# Get image location
$image_file= $fname;
$image_path = IMAGE_BASE . "$image_file";

# Load image
$img = null;
$ext = strtolower(end(explode('.', $image_path)));
if ($ext == 'jpg' || $ext == 'jpeg') {
    $img = @imagecreatefromjpeg($image_path);
} else if ($ext == 'png') {
    $img = @imagecreatefrompng($image_path);
# Only if your version of GD includes GIF support
} else if ($ext == 'gif') {
    $img = @imagecreatefromgif($image_path);
}

# If an image was successfully loaded, test the image for size
if ($img) {

    # Get image size and scale ratio
    $width = imagesx($img);
    $height = imagesy($img);
    $scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);

    # If the image is larger than the max shrink it
    if ($scale < 1) {
        $new_width = floor($scale*$width);
        $new_height = floor($scale*$height);

        # Create a new temporary image
        $tmp_img = imagecreatetruecolor($new_width, $new_height);

        # Copy and resize old image into new image
        imagecopyresized($tmp_img, $img, 0, 0, 0, 0,
                         $new_width, $new_height, $width, $height);
        imagedestroy($img);
        $img = $tmp_img;
    }
}

# Create error image if necessary
if (!$img) {
    $img = imagecreate(MAX_WIDTH, MAX_HEIGHT);
    imagecolorallocate($img,0,0,0);
    $c = imagecolorallocate($img,70,70,70);
    imageline($img,0,0,MAX_WIDTH,MAX_HEIGHT,$c2);
    imageline($img,MAX_WIDTH,0,0,MAX_HEIGHT,$c2);
        $text_color = imagecolorallocate($img, 233, 14, 91);
    imagestring($img, 1, 5, 5,  "A Simple Text String", $text_color);
}

# Display the image

imagejpeg($img);

?>

高手些帮哈忙
哈哈,我现在就来!

应该是这样显示,不是include
<img src="tt.php">
毕业了。。。

谢谢管理员,我的图片显示的很正常了,不再像以前一样,一张大图片直接去把他的宽和高固定了!
非常感谢!
哈哈,我现在就来!