【发布时间】:2015-02-28 08:35:46
【问题描述】:
我目前正在制作一个页面,您可以在其中上传图片。 我需要知道的是上传图片时添加的文本水印,您应该可以插入文本,该文本将显示在水印中。
这是我的 php
$location = '/usr/local/apache/htdocs/images/'.$_FILES['file']['name'];
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
if (!move_uploaded_file($_FILES['file']['tmp_name'], $location)) {
echo 'you cant copy your file';
exit;
} else {
echo 'you uploaded correctly<br><br>';
exit;
}
exit;
}
这就是html
<input type="file" name="file" /><br />
<input type="submit" value="Send" /> <br/>
</form>
我找了一会儿,没有找到我能正确理解的教程
【问题讨论】:
-
查看PHP Manual for
imagettftext和this answer elaborating the code to write text to images。如果这对你来说还不够简单,我已经写了一个 old set of classes that wrap the GD functionality(相关的类以Image开头。我的东西没有很好的文档记录。 -
php.net/manual/en/image.examples.merged-watermark.php 我正在尝试使用它,但我想知道如何更改此行 '$im = imagecreatefromjpeg('photo.jpeg');' photo.jpeg 到我上传的文件。