Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from google.appengine.api import images
- from google.appengine.ext import blobstore
- def _get_urls_for(self, file_name):
- user = users.get_current_user()
- if user is None:
- return
- bucket_name = app_identity.get_default_gcs_bucket_name()
- path = os.path.join('/', bucket_name, user.user_id(), file_name)
- real_path = '/gs' + path
- key = blobstore.create_gs_key(real_path)
- url = images.get_serving_url(key, size=0)
- thumbnail_url = images.get_serving_url(key, size=150, crop=True)
- return url, thumbnail_url
- http://localhost:8080/_ah/img/encoded_gs_file:YXBwX2RlZmF1bHRfYnVja2V0LzE4NTgwNDc2NDIyMDEzOTEyNDExOC9pbWc4NzYuanBn=s32
- http://localhost:8080/_ah/img/encoded_gs_file:YXBwX2RlZmF1bHRfYnVja2V0LzE4NTgwNDc2NDIyMDEzOTEyNDExOC9pbWc4NzYuanBn=s150-c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement