Image Database Module

The full documentation of the 'Image Database' module.

The image database module is designed to provide developers the ability to quickly store and access image data using the multi-threaded downloading and processing of the source images. You may store downscaled versions of the images you may need, to manage your work from one centralized, lightweight place.

Referencing

To reference the module in your project, you may do the following in your class' constructor:

It can ideally be defined as a field/property initializer or setting the module singleton instance in one of the Init() or OnServerInitialized() hooks.
using Carbon.Modules;
using Carbon.Base;
public ImageDatabaseModule ImageDatabase = BaseModule.GetModule<ImageDatabaseModule>();

Commands

Image database provides 2 debugging commands that are for general purpose.

imagedb.pending

  • Prints info about the currently pending queued elements.

imagedb.clearinvalid

  • It will immediately clear any invalid images that exceed the hard limit buffer size of the server (3.9MB), which when bypassed, it'll kick players from the server.

API

Here's a list of the API that you may use in your projects:

@override will erase existent url data from the server before requesting it.
QueueBatch(bool @override, params string[] urls);
`scale` resizes the images that are stored, `@override` will erase existent url data from the server before requesting it.
QueueBatch(float scale, bool @override, params string[] urls);
`scale` resizes the images that are stored, `@override` will erase existent url data from the server before requesting it, onComplete callback gets called after a batch has finished (ignores failed requests and returns anything that was stored).
QueueBatch(float scale, bool @override, Action<List<QueuedThreadResult>> onComplete, params string[] urls);
Assigns a key to an URL that makes it easier to look up in the database, rather than directly using the full URL.
AddMap(string key, string url);
Removes a mapping using a key.
RemoveMap(string key);
Attempts to retrieve the processed image ID from the server
GetImage(string keyOrUrl, float scale = 0, bool silent = false);
Attempts to retrieve the processed image ID from the server
GetImageString(string keyOrUrl, float scale = 0, bool silent = false);
Entirely erases an image with the URL from the server
DeleteImage(string url, float scale = 0);
Generates a QR code, stores it in the FileStorage database.
GetQRCode(string text, int pixels = 20, bool transparent = false, bool quietZones = true, bool whiteMode = false);

The Image Database module is enabled by default and will not enforce the server to be in the modded tab when enabled.

Last updated