I'm currently making an image sharing site in Appengine, it's mostly working how I want it, but sometimes I would like a small version of an image (thumbnail) - at the moment I'm shrinking it with HTML, but the browser still loads the full (up to 32MB image) when that is entirely unnecessary. How do I show a lower quality, smaller image to save bandwidth?
Code for serving the image. This is 'mysite.com/view'
class ViewPhotoHandler(blobstore_handlers.BlobstoreDownloadHandler):
def get(self, photo_key):
if not blobstore.get(photo_key):
self.error(404)
else:
self.send_blob(photo_key)
code for requesting the image.
p.blob_key is a string
link = '/view/%s' % p.blob_key
self.response.write('<img src="' + link + '" alt="Image" height="50" width="50">')
So, everything works how it should, but it wastes too much bandwidth when requesting the small version of the image.
Any ideas on how I can solve this? Thanks