我试图在我的图像上放置水印,但脚本无法找到我的水印图像。我正在动态执行此操作,因此对于每个用户,水印文件夹中都有一个水印。尝试使用此代码时:在GD(PHP)中找不到图像
session_start();
$username = $_SESSION['_user_login'];
// Set the path to the image to watermark
$input_image = $targetPath.$newName;
// Read in the text watermark image
$watermark = imagecreatefrompng("../watermarks/$username.png");
没有任何反应。我试图打印用户名变量,它工作正常。我甚至试图打印图像,它也适用。但是当使用imagecreatefrompng时,永远不会找到水印图像。看我的日志我看到以下错误:
Warning: imagecreatefrompng(../watermarks/.png) [function.imagecreatefrompng]: failed to open stream: No such file or directory
我不明白。我究竟做错了什么?
谢谢。
如果你通过'./../水印'$ username。'。png'',会发生什么? – rhino 2010-11-15 16:48:13