Skip to content

feats/python-gcs-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disclaimer 1: This solution is based on the App Engine's Python 2 environment. There are plans to replace it by something more modern.

Disclaimer 2: There are alternative implementations of this same solution that seem to be better maintained. Please consider taking a look at albertcht/python-gcs-image.


App Engine provides the ability to manipulate image data using a dedicated Images service. The Images service can manipulate images, composite multiple images into a single image, convert image formats, provide image metadata such as format, width, height, and a histogram of color values.

⚠️ Please note: even though the image will be served completely independent from our app, we can only generate the url we need from within Google's App Engine. It's the only fucking way! Once we have the URL, we can serve the images and manipulate them as we want...

Obtains a URL that will serve the underlying image.

This URL is served by a high-performance dynamic image serving infrastructure. As the image is served independently from your app, it does not generate load and can be highly cost effective. The URL returned by this method is always publicly accessible but not guessable.

The method returns a URL encoded with the specified size and crop arguments allowing dynamic resizing and cropping with certain restrictions. If you do not specify any arguments, the method returns the default URL for the image. To dynamically resize and crop, specify size and crop arguments, or simply append options to the end of the default URL obtained via this call.

Example:

get_serving_url -> "http://lh3.ggpht.com/SomeCharactersGoesHere"

To get a 32-pixel-sized version (aspect-ratio preserved), append =s32 to the URL:

http://lh3.ggpht.com/SomeCharactersGoesHere=s32

To get a 32-pixel cropped version, append =s32-c:

http://lh3.ggpht.com/SomeCharactersGoesHere=s32-c

Available sizes are any integer in the range [0, 3200] and is available as IMG_SERVING_SIZES_LIMIT.

Parameters

  • blob_key – The BlobKey, BlobInfo, string, or Unicode representation of BlobKey of the blob whose URL you require.

  • size – Integer of the size of resulting images.

  • crop – Boolean value. True requests a cropped image, while False requests a resized image.

  • secure_url – Boolean value. True requests a https URL, while False requests a http URL.

  • filename – The file name of a Google Storage object whose URL you require.

  • rpc – Optional UserRPC object.

Returns A URL string.

There are many more parameters that can be used, but they are not officially supported.

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages