Skip to main content

A thumbor server extension for DASH

Project description

thumbor_dash

A thumbor server extension for DASH

Setup

Requirements

  • Python >= 3.9
  • Pip >= 21.1
  • Thumbor == 7.0.0a5

See the requirements for setting up thumbor in the documentation

1. Install thumbor_dash

pip install thumbor_dash

Note: thumbor_dash, thumbor, and other required dependencies will be installed

2. Create a thumbor configuration file

thumbor-config > thumbor.conf

3. Add these lines to thumbor.conf file

# Set allowed dimensions
MIN_WIDTH = 1
MIN_HEIGHT = 1
MAX_WIDTH = 1200
MAX_HEIGHT = 800

# Set security key
SECURITY_KEY = "0"

# Url signing method
URL_SIGNER = 'thumbor_dash.url_signers.base64_hmac_sha256'

# Use only signed URL
ALLOW_UNSAFE_URL = False

# Set user moderation rules
REQUEST_TIME_LIMIT = 1 # time between requests in minutes
USAGE_VIOLATION_LIMIT = 5 # total number of times a requester can violate the time limit before ban
BAN_DURATION = 10 # requester ban duration in minutes

Usage

1. Start thumbor_dash server

thumbor_dash --conf=thumbor.conf

2. Sign image URL

thumbor_dash-url --key="<SECURITY_KEY>" --width=<width> --height=<height> --dashauth="requester(<requesterId>):contract(<contractId>):document(<documentType>):field(<avatarUrl>):owner(<ownerId>):updatedAt(<updatedAt>)" --filters="<filters>" <imageURL>

output:

/<signature>/<width>x<height>/dashauth:requester(<requesterId>):contract(<contractId>):document(<documentType>):field(<field>):owner(<ownerId>):updatedAt(<updatedAt>)/filters:format(<format>)/<encodedImageUrl>

3. Thumbor_dash image retrieval URL

http://<thumbor_dash-server>/<signature>/<width>x<height>/dashauth:requester(<requesterId>):contract(<contractId>):document(<documentType>):field(<field>):owner(<ownerId>):updatedAt(<updatedAt>)/filters:format(<format>)/<encodedImageUrl>

Note: If running the server locally, <thumbor_dash-server> should be localhost:8888

Example

This is a signed thumbor_dash url. Simply run thumbor_dash and paste this link in your browser.

http://localhost:8888/MXd8uDwHf1xqp6YG0RzlkrmtdBaq1ZyzznPLJft1rl4=/1200x800/dashauth:requester(26AxVi5bvYYaC94GmeTmqX21vzsSxar2a4imxSE8ULUQ):contract(D6tjxCZzZobDQztc4S1PK7EDwm4CegLARpiKZn6jQc1R):document(thumbnailField):field(avatarUrl):owner(26AxVi5bvYYaC94GmeTmqX21vzsSxar2a4imxSE8ULUQ):updatedAt(1627948894242)/filters:format(jpeg)/https%3A//github.com/thumbor/thumbor/raw/master/example.jpg

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

thumbor_dash-0.0.6.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

thumbor_dash-0.0.6-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file thumbor_dash-0.0.6.tar.gz.

File metadata

  • Download URL: thumbor_dash-0.0.6.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for thumbor_dash-0.0.6.tar.gz
Algorithm Hash digest
SHA256 aa505ec50bcb41ed49b1942570c71b0e3ae450b9c222786a63908930e83787e3
MD5 226c9d9da5e76c1a2a75994524d6d516
BLAKE2b-256 90d28f94a087c054b3fe5b2aeb2bd093729571ce032bcaebf3bed9a1c1867e13

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thumbor_dash-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for thumbor_dash-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e9313807fe213fb9d673c39d1019898e441be9c9945b74dc927817c292aa0a27
MD5 7cb466424d2b4bfcf153937cc3faf41b
BLAKE2b-256 66f69b8a0364607a18b6bbf116f5a7e6202f4a89d0c9540acc849ca1ae386218

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