Metadata-Version: 2.1
Name: thunagen
Version: 0.1.1
Summary: Google Cloud function to generate thumbnail for images in Google Storage.
Home-page: https://github.com/sunshine-tech/thunagen.git
License: Apache-2.0
Keywords: google,cloud,storage,functions,thumbnail
Author: Nguyễn Hồng Quân
Author-email: ng.hong.quan@gmail.com
Maintainer: Nguyễn Hồng Quân
Maintainer-email: ng.hong.quan@gmail.com
Requires-Python: >=3.7,<4.0
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Requires-Dist: Pillow (>=7.0.0,<8.0.0)
Requires-Dist: google-cloud-storage (>=1.24.1,<2.0.0)
Requires-Dist: lazy_object_proxy (>=1.4.3,<2.0.0)
Requires-Dist: logbook (>=1.5.3,<2.0.0)
Requires-Dist: python-dotenv (>=0.10.3,<0.11.0)
Project-URL: Repository, https://github.com/sunshine-tech/thunagen.git
Description-Content-Type: text/x-rst

========
Thunagen
========


Google Cloud function to generate thumbnail for images in Google Storage.

Convention
----------

The thumbnails are placed in a folder "thumbnails" at the same place as original file.

The thumbnail size is appended to filename, right before the extention part. For example:


.. code-block::

    bucket
    └── folder
        ├── photo.jpg
        └── thumbnails
            ├── photo_128x128.jpg
            └── photo_512x512.jpg

The function expect these environment variables to be set:

- ``THUMB_SIZES``: Size of thumbnail to be generated. Example: ``512x512,128x128``.

- ``MONITORED_PATHS``: Folders (and theirs children) where the function will process the uploaded images. Muliple paths are separated by ":", like ``user-docs:user-profiles``.

The variables can be passed via *.env* file in the working directory.

Include to your project
-----------------------

Thunagen is provided without a *main.py* file, for you to easier incorporate to your project, where you may have your own way to configure deployment environment (different bucket for "staging" and "production", for example).

To include Thunagen, from your *main.py*, do:

.. code-block:: py

    from thunagen.functions import generate_gs_thumbnail

