实现图片上传库关键字的最佳方法

发布于 2024-08-29 04:56:29 字数 266 浏览 2 评论 0原文

我开始指定一个类似于 Facebook 的图片库类型系统。该网站的成员将能够创建图像库并上传图像供其他人查看。图像将具有上传者可以指定的关键字。

这里的问题是,建模的最佳方法是什么?通过 HABTM 关系链接图像和关键字表?或者单个图像表,其中关键字以逗号分隔值保存在图像记录的文本字段中?然后使用 LIKE 或 FULL TEXT 索引功能搜索它们?

我希望能够提取包含给定关键字的所有图像并生成关键字云。

我倾向于 HABTM 设置,但我想看看其他人的设置。谢谢!!

I'm starting to spec out an image gallery type system similar to Facebook's. Members of the site will be able to create image galleries and upload images for others to view. Images will have keywords the the uploader can specify.

Here's the question, what's the best way to model this? With image and keyword tables linked vi a HABTM relation? Or a single image table with the keywords saved as comma delimited values in a text field in the image record? Then search them using a LIKE or FULL TEXT index function?

I want to be able to pull up all images containing a given keyword as well as generate a keyword cloud.

I'm leaning toward the HABTM setup but I wanted to see what everyone else though. Thanks!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风筝在阴天搁浅。 2024-09-05 04:56:29

我强烈建议建立 HABTM 关系。恕我直言,在一列中存储多个字段(例如逗号分隔的标签)是一个糟糕的主意...想想搜索多个标签时的噩梦,或者如果以错误的顺序输入关键字!此外,如果没有关键字表,生成关键字云几乎是不可能的。

所以是的,我想这就是我的 2 美分 :D

I'd highly suggest a HABTM relationship. IMHO, storing multiple fields in one column (e.g. comma delimited tags) is a terrible idea... Think of the nightmare you'll have in searching multiple tags, or if the keywords were input in the wrong order! Also, generating a keyword cloud would be nigh impossible if you don't have a keywords table.

So yea, I guess that's my 2 cents :D

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文