图像存储在mysql或服务器上用于内容管理
我一直在使用 php sql 系统来管理我网站上的图像。我可以使用 php 轻松上传新图像、编辑现有图像并从 mysql 中删除它们。 然而,我发现填充从 xml 驱动的 flash gallery 极其困难,因为我无法正确地将 BLOB 数据传输到 xml。
因此,我设置了一个上传脚本,将图像插入到我的服务器上的“图像”文件夹中,并在 mysql 表中添加 id、图像路径、标题和图库。一切正常,但现在当涉及到编辑和删除图像时,我陷入困境!
您是否建议我坚持使用第一种方法(将图像存储为 BLOB)并尝试找出如何使用这些数据填充幻灯片,或者坚持使用第二种方法并寻求有关如何使用 php 编辑和删除图像的建议?
预先感谢您的建议,现在尝试解决这个问题变得越来越有压力!我所需要的只是一个简单的图像管理工具,还可以填充幻灯片......!
京东
I have been using a php sql system to manage images on my website. I can easily upload new images, edit existing ones and delete them from mysql using php.
However, I was finding it extremely difficult to populate flash galleries driven from xml as I couldn't transfer the BLOB data to xml correctly.
Consequently, I have setup an upload script that inserts the image into an "images" folder on my server, and adds id, image path, title and gallery in a mysql table. It is all working correctly, but now when it comes to editing and deleting the images I am stuck!
Would you recommend I stick with the first methodology (storing images as BLOBs) and try to figure out how to populate slideshows with this data, OR stick with the second approach and seek advice on how to edit and delete the images using php?
Thanks in advance for the advice, getting more and more stressed trying to get this sorted now! All I need is a simple image management tool that can also populate slideshows....!
JD
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我看来,您的新方法更可取,而且我个人知道在我的工作环境中没有项目使用 blob 来存储图像(并且我们有一些令人惊叹的 web2print 解决方案)。
我建议您查找一些有关在 Google 中操作文件的教程。这很容易!
下面是一个小例子,说明了如何做到这一点。这包括很多猜测——因为我不知道你的设置/代码/安全要求。我建议您开始并发布您可能遇到的任何其他问题。
Your new approach is preferable in my opinion, and I personally know of no projects in my working environment that use blobs to store images (and we have some amazing web2print solutions).
I suggest you look for some tutorials about manipulating files in Google. It's easy!
Below is an tiny example of how you could do it. This includes alot of guessing though - as I do not know your setup / code / security requirements. I suggest you just get started and post any further problems you might encounter.
我个人更喜欢将图像存储在高清硬盘上。这允许轻松扩展(您可以将图像移至 NFS 或 CDN 或其他任何位置)
如果您将图像名称存储在数据库中,那么从 HD 中拾取并编辑文件应该不是什么大问题,您可以始终使用 unlink() 来删除文件,这不像从数据库中删除记录那么容易,但我认为从长远来看,这种努力是值得的。
此外,我相信当您将图像存储在高清硬盘上时,您会减轻数据库服务器的大量负载。所以我认为你坚持新的方法并解决你遇到的问题。
只是我的2分钱。
I personally prefer storing the image on the HD. This allows for easy scalability (you can move off your images to NFS or CDN or whatever)
If you have the image name stored in the DB, then picking up and editing the file from the HD shouldn't be a big deal and you can always use
unlink()
to delete the file, not as easy as deleting the record from the DB but i think the effort is worth it in the long term.Besides i believe when you store images on the HD, you are taking a substantial load off of your DB server. So i think you stick with the new approach and iron out the issues you are having.
Just my 2 cents.