我在服务器上有图像。我想在图像上做一个水印(文本),并用其他名称将此图像保存为新图像。我的功能是:
function watermark($path, $watermark){
$imageURL = $path;
list($width,$height) = getimagesize($imageURL);
$imageProperties = imagecreatetruecolor($width, $height);
$targetLayer = imagecreatefromjpeg($imageURL);
imagecopyresampled($imageProperties, $targetLayer, 0, 0, 0, 0, $width, $height, $width, $height);
$WaterMarkText = $watermark;
$watermarkColor = imagecolorallocate($imageProperties, 191,191,191);
imagestring($imageProperties, 5, 130, 117, $WaterMarkText, $watermarkColor);
imagejpeg ($imageProperties);
imagedestroy($targetLayer);
imagedestroy($imageProperties);
}
其中参数为:
$watermark = $_POST['watermark'];
$path = "/images/$file_name";
当我启动scypt时,带有水印的图像正在创建并显示在屏幕上。我的目标是不显示新图像,而是将其保存在名为$file_name_watermark的同一文件夹中。我该怎么做?