imagecopyresized()无效的图像尺寸


imagecopyresized() invalid image dimensions?

我在尝试创建图像缩略图时遇到以下错误:

Warning: imagecopyresized() [function.imagecopyresized]: Invalid image dimensions in H:'Programs'webserver'root'media'images'inc'func.php on line 160

这是我为完成这项工作而创建的功能:

function create_thumbnail($image_type, $image_height, $image_height, $temp_dir, $thumb_path, $thumb_width, $thumb_height){
    switch($image_type){
        case 'image/jpeg';
            $img =      imagecreatefromjpeg($temp_dir);
            $thumb =    imagecreatetruecolor($thumb_width, $thumb_height);
                        imagecopyresized($thumb, $img, 0, 0, 0, 0, $thumb_width, $thumb_height, $image_width, $image_height);
                        imagejpeg($thumb, $thumb_path, 100);

        break;
        case 'image/png';
            $img =      imagecreatefrompng($temp_dir);
            $thumb =    imagecreatetruecolor($thumb_width, $thumb_height);
                        imagecopyresized($thumb, $img, 0, 0, 0, 0, $thumb_width, $thumb_height, $image_width, $image_height );
                        imagepng($thumb, $thumb_path, 100);
        break;
        case 'image/gif';
            $img =      imagecreatefromgif($temp_dir);
            $thumb =    imagecreatetruecolor($thumb_width, $thumb_height);
                        imagecopyresized($thumb, $img, 0, 0, 0, 0, $thumb_width, $thumb_height, $image_width, $image_height );
                        imagegif($thumb, $thumb_path, 100);
        break;
    }
}

它是这样使用的:

// Create the new thumbnail dimensions
                        list($thumb_width, $thumb_height) = thumb_dimensions($case, $image_width, $image_height);
                        // Create the thumbnails
                        create_thumbnail($image_type, $image_height, $image_height, $temp_dir, $thumb_path, $thumb_width, $thumb_height);

拇指的尺寸是:宽:100px,高:99px;

在函数定义中键入:

function create_thumbnail($image_type, $image_height, $image_height, ...
                                           ^^------dupe----^^

这意味着CCD_ 1没有被定义并且可能被评估为0。

最后的示例create_thumbnail()调用也是如此——两个image_heights,没有image_width。