我有一个关于如何在移动文件时过滤图片的问题。我使用uploadify上传图片。我所做的是,在将图像移动到目录之前,代码过滤器会将图像转换为灰度。PHP imagefilter和uploadify
这里是我的代码
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$newImg = imagefilter($tempFile, IMG_FILTER_GRAYSCALE); // This is what I insert
move_uploaded_file($newImg,$targetFile);
echo "1";
}
的代码是uploadify.php,我只是插入一个过滤器,使其灰阶。请帮帮我。提前致谢。
您的问题是什么? – 2011-04-06 08:30:20
关于如何在将图像移动到目录之前将图像制作成灰度图 – Jorge 2011-04-06 08:32:01
'imagefilter()'适用于需要使用适当的'imagecreatefrom *()'函数首先初始化的图像资源。有关示例,请参见[imagefilter']手册(http://www.php.net/imagefilter)。 – 2011-04-06 08:39:01