If you are going to save a picture as an image, you have several possible solutions.
- Save the item somewhere in the folder and save the directory path + file name in your database
- Save images to the database as
blob . However, Blobs do work really hard with the database.
There are some interesting articles about blob. Like this one from Microsoft.
As expected from common wisdom, objects smaller than 256 KB are best stored in the database, and objects larger than 1 M are best stored in the file system.
Thus, this would be the best solution to save the image to a directory.
You can also export the svg file of the drawn image. ( info ) I do not know if this will help you, but this is my personal experience. And I agree with you that storing thousands of commands in a database is not the best solution. Thus, you may want to take a look at saving images somewhere, but then you will lose the ability to edit the image, if implemented.
Update:
If you do not want to save blob , the best solution would be to "render" the image every time you edit it. This way you can execute all the commands when someone opens a drawing. And just use the latest commands when starting editing.
There are several options for achieving this. As Jimmy Chandra said, firebase would be a good solution. They also provide a tutorial that has everything you want to achieve. (drawing an image using x and y coordinates in real time). Maybe you should take a look at this.
A bit more information about Firebase.
Firebase is a powerful API for storing and synchronizing data in real time.
This is exactly what you want to achieve, I believe. You can try the full tutorial here .
Another option you can consider is nodejs . I have seen people using nodejs for chat systems to send data to all other users. If you can send data, I'm sure you can make an image with it.
In the end, it's up to you which technology you want to use. Therefore, I think that you will have to research several solutions, as I suggested, and ask another question if you have any problems with the integration of this technology.