Directus Extension: Base64 Image Encoder
This is a Directus extension that encodes uploaded images in base64 format. The extension takes an image file as input and returns its base64 encoded string.
Installation
To install this extension, follow these steps:
- Clone the repository to your local machine.
- Navigate to the repository directory.
- Run
npm install
to install the required dependencies. - Copy the entire repository folder to the
/extensions/custom
folder of your Directus installation.
Usage
To use the extension, follow these steps:
- Navigate to your Directus project.
- Go to the settings page of the collection where you want to enable the extension.
- Click on the "Extensions" tab.
- Enable the "Base64 Image Encoder" extension.
- Click on the "Save" button to save the changes.
After enabling the extension, uploaded images in the collection will be automatically encoded in base64 format.
Configuration
This extension does not require any configuration.
Development
To develop this extension further, follow these steps:
- Clone the repository to your local machine.
- Navigate to the repository directory.
- Run
npm install
to install the required dependencies. - Run
npm run dev
to start the development server. - Make changes to the code as necessary.
- Test the changes by uploading an image in the collection where the extension is enabled.
- Commit the changes and create a pull request.
Dependencies
This extension depends on the following packages:
@directus/extensions-sdk
path
sharp
Todo
License
This extension is licensed under the MIT License. See the LICENSE file for more information.