调整png's大小的问题


Problems with resizing png's

我有一个问题调整我的minecraft皮肤与这个脚本。当我在我的本地主机上测试它时,一切工作100%正常,但是当我将它上传到我的服务器时,它只显示一个调整大小的透明图像,没有内容。脚本如下:

<?php
function clean($str) {
    $str = @trim($str);
    if(get_magic_quotes_gpc()) {
        $str = stripslashes($str);
    }
    return mysql_real_escape_string($str);
 }
// File and new size
$fil = clean($_GET['skin']);
 header('Content-type: image/png');
//$myimage = resizeImage('filename', 'newwidthmax', 'newheightmax');
function resizeImage($filename, $newwidth, $newheight){
list($width, $height) = getimagesize($filename);
$thumb = imagecreatetruecolor($newwidth, $newheight);
$transparent = imagecolorallocate($thumb, 200, 255, 200);
imagefill($thumb, 0, 0, $transparent);
imagecolortransparent($thumb, $transparent);
$source = imagecreatefrompng($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
return imagepng($thumb);
}
$myimage = resizeImage($fil, '640', '320');
print $myimage;
?>

您可以在这里看到输出:link

mysql_real_escape_string需要一个已经打开的mysql连接。它将使用最后打开的连接,如果不存在则返回false。也许这就是你丢失数据的地方。