【发布时间】:2011-04-06 08:29:38
【问题描述】:
我有一个关于如何在移动文件时过滤图像的问题。我使用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,我只是插入了一个过滤器使其成为灰度。请帮我。提前致谢。
【问题讨论】:
-
关于如何在将图像移动到目录之前将其设置为灰度
-
imagefilter()适用于您需要首先使用适当的imagecreatefrom*()函数初始化的图像资源。有关示例,请参见 manual onimagefilter。
标签: php gd uploadify imagefilter