Skip to main content

Render local images in the system using datasette plugin

Project description

datasette-render-local-images

PyPI Changelog Tests License

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.

Below screenshoot is from the sample table.

Sample Screenshoot

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

datasette-render-local-images-0.0.6.tar.gz (227.5 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page