Just another WordPress.com site

Archive for the ‘Uncategorized’ Category

Storing images as blob in appengine(<1mb)

I created something simliar to what you want to achieve.. Hope this helps


    import os
    from google.appengine.ext import db
    from google.appengine.ext import webapp
    from google.appengine.ext.webapp import template
    from google.appengine.ext.webapp.util import run_wsgi_app
    class Profile(db.Model):
    class disp_image(webapp.RequestHandler):       
                    def get(self): 
                        key = self.request.get('key')
                        image = Profile.get(key)
                        self.response.headers['Content-Type'] = "image/png"
                        return self.response.out.write(image.image)
    class MainPage(webapp.RequestHandler):
        def get(self):
            image = self.request.get('image')
            if image:   
                pro.image = db.Blob(image)
                import logging

            return self.response.out.write(template.render('view.html',{'prof':prof}))
        def post(self):
            return MainPage.get(self)
    application = webapp.WSGIApplication([
      ('/', MainPage),
      ('/disp', disp_image)
    ], debug=True)
    def main():
    if __name__ == '__main__':


  {% for prof in prof %}  {% endfor %} 


    application: sample-app
    version: 1
    runtime: python
    api_version: 1

    - url: /.*
      script: image.py

Hello world!

Welcome to WordPress.com. After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can alway preview any post or edit you before you share it to the world.

Tag Cloud