Skip to main content

A tiny library to simplify generation of imgproxy urls

Project description

Build Status PyPI PyPI - Python Version

imgproxy_python

A tiny library to simplify generation of imgproxy urls

installation

pip install imgproxy_python

usage

For example you want to simply resize your image to other height and width using imgproxy. To get proper imgproxy url you need the following

from imgproxy_python.urls import UrlGenerator
config = {
        'imgproxy_key': '943b421c9eb07c830af81030552c86009268de4e532ba2ee2eab8247c6da0881',
        'imgproxy_salt': '520f986b998545b4785e0defbc4f3c1203f22de2374a3d53cb7a7fe9fea309c5',
        'imgproxy_host': 'http://localhost:8000',
        'options': {
            'resize': 'fill',
            'width': 300,
            'height': 300,
        }
    }
    url = 'http://img.example.com/pretty/image.jpg'
    urlgen = UrlGenerator(url, config)
    print(urlgen.get_full_signed_url())

You will get a ready-to-go imgproxy link

http://localhost:8000/6cy4IRuQ1nQW8qGVmNvPdynjmkuwUEx-XhGw_C_kQmA/fill/300/300/ce/0/aHR0cDovL2ltZy5l/eGFtcGxlLmNvbS9w/cmV0dHkvaW1hZ2Uu/anBn

warning

If you want to have generated link working you need to have imgproxy instance up and running on config['imgproxy_host'], in our example it is http://localhost:8000

diclaimer

for now only basic urls are supported in version 0.0.1. Advanced url generation is coming

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

imgproxy_python-0.0.2.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

imgproxy_python-0.0.2-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file imgproxy_python-0.0.2.tar.gz.

File metadata

  • Download URL: imgproxy_python-0.0.2.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.6.9 Linux/4.15.0-132-generic

File hashes

Hashes for imgproxy_python-0.0.2.tar.gz
Algorithm Hash digest
SHA256 25b45143f3a22b7a61c5c2acf4bc3f061d4c507c5c86eb256b021a9c22fb0791
MD5 f98ab77b1ad125125a8ea6eb13c89674
BLAKE2b-256 5cfe85a417d6518aa99b57bd64e989955922d4679ee9b34dc08e4d7be891d0aa

See more details on using hashes here.

File details

Details for the file imgproxy_python-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: imgproxy_python-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.6.9 Linux/4.15.0-132-generic

File hashes

Hashes for imgproxy_python-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e9cbebd434c6bbb81e5b59eedfd3f1694f8e59e657f7e523843dd19e8a00ee4
MD5 d34bdb8688e4c576de1b4922d82af884
BLAKE2b-256 5fa7b28341178158d7d782a4bf2c807da83bf67423b59199b8a4b91b324fc4ec

See more details on using hashes here.

Supported by

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