如何使用 Image Resizer 使缩略图转到 /tmp/thumb/ 并将原始图像保留在 /tmp/ 上?
我正在尝试使用图像调整器,我得到了以下代码
if (is_uploaded_file(@$_FILES['ulimage']['tmp_name'])){
$targetfilename = ImageHelper::treatFilename(uniqid() . "_" . $_FILES['ulimage']['name']);
move_uploaded_file($_FILES['ulimage']['tmp_name'], dirname(__FILE__) . "/tmp/" . $_FILES['ulimage']['name']);
ImageHelper::resizeImage(dirname(__FILE__) . "/tmp/" . @$_FILES['ulimage']['name'], dirname(__FILE__) . "/tmp/" . $targetfilename, $width, $height);
}
现在,原始图像和缩略图将放置在同一文件夹中。
让我知道..
I'm trying to play with image resizer and I got the following code
if (is_uploaded_file(@$_FILES['ulimage']['tmp_name'])){
$targetfilename = ImageHelper::treatFilename(uniqid() . "_" . $_FILES['ulimage']['name']);
move_uploaded_file($_FILES['ulimage']['tmp_name'], dirname(__FILE__) . "/tmp/" . $_FILES['ulimage']['name']);
ImageHelper::resizeImage(dirname(__FILE__) . "/tmp/" . @$_FILES['ulimage']['name'], dirname(__FILE__) . "/tmp/" . $targetfilename, $width, $height);
}
For now, the original image and the thumbnail will place in same folder.
Let me know..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嘿伙计,这看起来非常困难,但可以简单地使用 Thumbnailer 库及其上传助手来制作:
非常简单: )
Hey man, this looks very tough, but can be made simply using the Thumbnailer library and its upload helper:
Very easy :)
好吧,答案是:
但也许您想在使用之前先了解一下从网上复制和粘贴的代码。 使用 $_ vars 而不转义系统并使用 @ 隐藏错误并不是真正需要信任...
编辑:我正在提供建议,但也许最好也给出一些解释。
Well, the answer is :
But maybe you'd like to understand a bit the code you copy and past from the Net before using it. Using $_ vars without escaping system and with @ to hide error is not really calling for trust...
EDIT : I'm giving advices, but maybe it's better to give some explanation as well.