在应用程序中,我使用 Fabric.js,它让用户编写文本、绘制 SVG、插入图像等。
我想知道存储这些数据的最佳方式是什么。
要求是:
-
能够查询数据(文本),这告诉我应该将其存储在数据库中(目前为 MySQL)
-
我有图像,并且我的目标也是 iPad,因此图像对于它们的存储方式很重要。
-
SVG 和 HTML/CSS 也将被保存。
-
我还想对内容进行版本控制,就像 Quora 所做的那样,以便用户可以看到从过去版本到当前版本的更改。这还包括图像和 SVG 的版本控制。
我想知道 Google 文档是如何做到这一点的,因为它们还存储我们的文档、绘图等。
执行此操作的最佳方法是什么?
In an application, I am using Fabric.js, which lets users write text, draw SVG's, insert images etc.
I want to know, what is the best way to store this data.
Requirements are:
-
Ability to query the data(text), which tells me that i should store it in DB (MySQL as of now)
-
I have images, and I am targeting IPad as well, so the images are important, as to how they are stored.
-
SVG's and HTML/CSS to be saved as well.
-
I also want to do versioning of the content, as Quora does it, so that a user can see the changes from the past version to the current version. This also includes the versioning of images and SVG's.
I am wondering how Google Docs does it, because they also store our documents, drawings etc.
What is the best way of doing this?
发布评论
评论(4)
我不知道这是否有帮助,但是,Opera 浏览器提供了一个选项,可以将网页保存到一个唯一的文件 { mht 扩展名 },这会将所有文件 { css、图像、脚本等 } 以 Base64 编码的文本形式存储以供以后使用 { 当文档已打开}...也许这可以是存储数据的一种方式:P
i dont known if it helps but, Opera browser offer an option to save the webpages to an unique file { mht extension }, this stores all the files { css, images, scripts, etc } in base64 encoded text for a later use { when the document is opened }... maybe this can be a way to store data :P
我管理一个网络应用程序,用户在其中生成报告,发现在文件系统中存储图像和二进制文件并从数据库链接到它们会更有效。 xml 或文本中的元素保留在数据库中以便于搜索 - 在您的情况下,这将包括 css/html 和 svg (即 xml)。使用数据库来管理修订。
也可以查看有关在数据库中存储图像的帖子。
看起来 Frabic.js 在后端使用了 node.js javascript Web 服务器 - 以前没有使用过这个,但您可能会调查哪些数据库最容易与 node.js 一起使用:
I manage a webapp where users generate reports, and found it more efficient to store images and binary files in the filesystem, and link to them from the database. Elements that are in xml or text are kept in the database for easier searching - in your case this would include css/html and svg (which is xml). Use the database for managing revisions.
Might also check out this thread on storing images in a database.
It looks like Frabic.js is using the node.js javascript webserver on the backend - haven't used this before, but you might investigate which databases are easiest to use with node.js:
如果你想高效地查询文本,那么也许将所有信息单独放入数据库是最有效的。也许您想使用 OOXML 或 ODF,它可以作为您需要的所有信息的容器,然后是 XML 存储(例如 eXist) 来存储和查询(例如文本)。由于这些标准是基于 XML 的,因此您可以将它们转换为 HTML(例如此处 或此处),但为此编写在线编辑器是一件怪物般的事情谷歌可以做到。
If you want to query the text efficiently, then perhaps putting all bits of information into the DB separately is the most efficient. Maybe you with to play with OOXML or ODF, that may serve as container for all information you require, and then XML-storage (e.g. eXist) to store it and query (e.g. the text). As these standards are XML-based, you can transform them into HTML (e.g. here or here) but writing an online editor for this is something that monster like Google can do.
您可以查看 NoSQL 数据库,例如 MongoDB 或
CouchDB
另请参阅在 NoSQL 存储中存储图像
You can take a look at NoSQL databases like MongoDB or
CouchDB
See also Storing images in NoSQL stores