Skip to content

Commit

Permalink
Make thumbnail public
Browse files Browse the repository at this point in the history
Also fix retrieving version
  • Loading branch information
hongquan committed Jan 7, 2020
1 parent b1d4b61 commit f5d5ba9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "thunagen"
version = "0.1.2"
version = "0.1.3"
description = "Google Cloud function to generate thumbnail for images in Google Storage."
authors = ["Nguyễn Hồng Quân <[email protected]>"]
maintainers = [
Expand Down
4 changes: 3 additions & 1 deletion thunagen/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
__version__ = '0.1.0'
from importlib_metadata import version

__version__ = version('thunagen')
4 changes: 4 additions & 0 deletions thunagen/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from google.cloud import storage
from google.cloud.exceptions import NotFound

from thunagen import __version__
from .common import GCFContext, ImgSize, Thumbnail
from .conf import get_monitored_paths, get_thumbnail_sizes

Expand Down Expand Up @@ -35,6 +36,9 @@ def upload(bucket: storage.Bucket, thumb: Thumbnail):
blob = bucket.blob(str(thumb.path))
blob.upload_from_string(thumb.content, thumb.mimetype)
logger.info('Uploaded {}.', thumb.path)
# TODO: Copy ALC from original image
blob.make_public()
blob.metadata = {'Generator': f'Thunagen v{__version__}'}


def create_thumbnail(orig: Image.Image, size: ImgSize, orpath: PurePosixPath) -> Thumbnail:
Expand Down

0 comments on commit f5d5ba9

Please sign in to comment.