예제 #1
0
파일: handlers.py 프로젝트: WentaoXu/newebe
    def post(self):
        '''
        Change current profile picture, resize it before that.
        '''
        (filebody, filename, filetype) = self.get_qq_file_infos()
        resizer = Resizer()
        picture = resizer.resize_and_get_file(filebody, 400, 400)
        small_picture = resizer.resize_and_get_file(filebody, 100, 100)

        user = UserManager.getUser()
        user.put_attachment(content=picture, name="picture.jpg")
        user.put_attachment(content=small_picture, name="small_picture.jpg")
        user.picture_content_type = filetype
        user.save()
        self.return_success("File uploaded")

        self.send_files_to_contacts(
            "contact/update-profile/picture/",
            fields={"key": user.key},
            files=[("small_picture", "small_picture.jpg", small_picture)]
        )
예제 #2
0
    def post(self):
        '''
        Change current profile picture, resize it before that.
        '''
        (filebody, filename, filetype) = self.get_qq_file_infos()
        resizer = Resizer()
        picture = resizer.resize_and_get_file(filebody, 400, 400)
        small_picture = resizer.resize_and_get_file(filebody, 100, 100)

        user = UserManager.getUser()
        user.put_attachment(content=picture, name="picture.jpg")
        user.put_attachment(content=small_picture, name="small_picture.jpg")
        user.picture_content_type = filetype
        user.save()
        self.return_success("File uploaded")

        small_picture = resizer.resize_and_get_file(filebody, 100, 100).read()
        self.send_files_to_contacts("contacts/update-profile/picture/",
                                    fields={"key": user.key},
                                    files=[("small_picture",
                                            "small_picture.jpg", small_picture)
                                           ])
예제 #3
0
def when_i_resize_it_to_300_x_300(step):
    resizer = Resizer()
    world.resized_image = resizer.resize(world.test_image.read(), 300, 300)
예제 #4
0
파일: picture.py 프로젝트: WentaoXu/newebe
def when_i_resize_it_to_300_x_300(step):
    resizer = Resizer()
    world.resized_image = resizer.resize(world.test_image, 300, 300)