Render local images in the system using datasette plugin
Project description
datasette-render-local-images
Render local images in the system using datasette plugin
Installation
Install this plugin in the same environment as Datasette.
$ datasette install datasette-render-local-images
Usage
Render local system images in the datasette displayed HTML.
The plugin reads the image and adds the base64 encoded data to src
attribute,
the cell looks like <img src="data:image/png;base64,A.." height="-1" width="-1">
By default plugin will figure out image and render with default height and width of the image.
To modify the image size and width, pass the configuration via metadata.json
{
"plugins": {
"datasette-render-local-images": {
"height": 150,
"width": 150
}
}
}
When the local image path is missing or no image specified in the path, the plugin will not render the value.
Note: While running datasette command don't forget to pass the metadata file
using -m
option like datasette dataset.db -m metadata.json
.
Below screenshoot is from the sample table.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-render-local-images
python3 -mvenv venv
source venv/bin/activate
Or if you are using pipenv
:
pipenv shell
Now install the dependencies and tests:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for datasette-render-local-images-0.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ccab99215a04ce9017790c5b319a4891cd16b836d9b3dc80339042c5ae81a87 |
|
MD5 | 1a97e50da21790cce6c356dc1864209d |
|
BLAKE2b-256 | 98fc85090604a614d52b043d81bf741c1a8513d484a4cd81b6c22ebfc273e136 |
Hashes for datasette_render_local_images-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51f36c4fda429ff1420dcf0af2286cbade5e5a8416a69f20895640053ece7563 |
|
MD5 | d09b740e394c87103df70946c2c93b2f |
|
BLAKE2b-256 | 722ffde24b382236fcd0c15fd85f066b98c29b9a8472b59e6a9ee28690f73dc6 |