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 details)

Uploaded Source

Built Distribution

File details

Details for the file datasette-render-local-images-0.0.6.tar.gz.

File metadata

  • Download URL: datasette-render-local-images-0.0.6.tar.gz
  • Upload date:
  • Size: 227.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for datasette-render-local-images-0.0.6.tar.gz
Algorithm Hash digest
SHA256 3126b09ca9c827da082fa1c8c13e31de1d1d9bf9c35a7822065d206c52a2c738
MD5 7057ecd97120a36226d01b46b5df0bd5
BLAKE2b-256 2e1489373c8ea453631c01796d3e594cc41b59bfe52bba7548a5fc5b321437db

See more details on using hashes here.

File details

Details for the file datasette_render_local_images-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: datasette_render_local_images-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for datasette_render_local_images-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e4b44543e48458fcc57e2cb03f278e17f7a9c3d6c040bc799402de1cd24cfa22
MD5 b842b898b4e278ea63fbe2a10aab12ff
BLAKE2b-256 55529d3db4e1eab90a8ffd194bc94a582356b4cab0b84827651c9369c824d177

See more details on using hashes here.

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