Пример #1
0
 def get(self):
     id = self.request.get('_id')
     width = self.request.get('width')
     height = self.request.get('height')
     picture = Picture.get_by_id(int(id))
     image = images.Image(picture.image)
     width = int(width) if width else image.width
     height = int(height) if height else image.height
     self.response.headers['Content-Type'] = 'image/jpeg'
     self.response.write(images.resize(picture.image, width, height))
Пример #2
0
    def get(self):
        id = self.request.get('_id')
        picture_id = self.request.get('picture_id')
        picture = Picture.get_by_id(int(picture_id)) if picture_id else None
        gallery_list = Gallery.all().order('-create_date')

        if id:
            gallery = Gallery.get_by_id(int(id))
        else:
            if picture is None:
                gallery = gallery_list.get()
            else:
                gallery = picture.gallery
        if gallery and (picture is None or picture.gallery.id != gallery.id):
            picture = gallery.pictures.get()

        self.render_to_template('porfolio.html', {
            'gallery_list': gallery_list,
            'gallery': gallery,
            'cur_picture': picture,
        })
Пример #3
0
 def get(self):
     id = self.request.get("_id")
     type = self.request.get("type")
     picture = Picture.get_by_id(int(id))
     self.response.headers["Content-Type"] = "image/jpeg"
     self.response.write(picture.image)