Beispiel #1
0
    def post(self):
        #upload_files = self.get_uploads('file')  # 'file' is file upload field in the form
        file_param = self.request.get_all('file', default_value='{}')
        logging.debug("file_param =  %s", type(file_param))
        upload_files = json.loads(file_param[0])

        images = []
        if type(upload_files) is list:
            for fn in upload_files:
                # print fn
                # file_from = cStringIO.StringIO()
                # file_from.write(fn)
                # file_to = cStringIO.StringIO()
                # print
                # print file_from
                # base64.decode(file_from, file_to)
                # print
                # print file_to
                images.append(Image.fromstring("RGBA", (800, 600), fn))
        else:
            images.append(Image.open(upload_files))

        # images = [Image.open(fn) for fn in upload_files]

        size = (300, 300)
        for im in images:
            im.thumbnail(size, Image.ANTIALIAS)

        out = cStringIO.StringIO()

        writeGif(out, images, duration=0.2)
        self.response.headers['Content-Type'] = "image/gif"
        self.response.out.write(out.getvalue())
Beispiel #2
0
    def post(self):
        #upload_files = self.get_uploads('file')  # 'file' is file upload field in the form
        file_param = self.request.get_all('file', default_value='{}')
        logging.debug("file_param =  %s", type(file_param))
        upload_files = json.loads(file_param[0])

        images = []
        if type(upload_files) is list:
            for fn in upload_files:
                # print fn
                # file_from = cStringIO.StringIO()
                # file_from.write(fn)
                # file_to = cStringIO.StringIO()
                # print
                # print file_from
                # base64.decode(file_from, file_to)
                # print
                # print file_to
                images.append(Image.fromstring("RGBA", (800, 600), fn))
        else:
            images.append(Image.open(upload_files))

        # images = [Image.open(fn) for fn in upload_files]

        size = (300, 300)
        for im in images:
            im.thumbnail(size, Image.ANTIALIAS)

        out = cStringIO.StringIO()

        writeGif(out, images, duration=0.2)
        self.response.headers['Content-Type'] = "image/gif"
        self.response.out.write(out.getvalue())
Beispiel #3
0
    def post(self):
        upload_files = self.get_uploads('file')  # 'file' is file upload field in the form
        images = [Image.open(fn) for fn in upload_files]

        size = (300, 300)
        for im in images:
            im.thumbnail(size, Image.ANTIALIAS)

        out = cStringIO.StringIO()

        writeGif(out, images, duration=0.2)
        self.response.headers['Content-Type'] = "image/gif"
        self.response.out.write(out.getvalue())
Beispiel #4
0
    def post(self):
        upload_files = self.get_uploads(
            'file')  # 'file' is file upload field in the form
        images = [Image.open(fn) for fn in upload_files]

        size = (300, 300)
        for im in images:
            im.thumbnail(size, Image.ANTIALIAS)

        out = cStringIO.StringIO()

        writeGif(out, images, duration=0.2)
        self.response.headers['Content-Type'] = "image/gif"
        self.response.out.write(out.getvalue())
Beispiel #5
0
    def get(self):
        path = os.path.dirname(__file__)
        file_names = sorted((fn for fn in os.listdir('static') if fn.endswith('.jpeg')))
        print file_names
        images = [Image.open("%s/../static/%s" % (path, fn)) for fn in file_names]

        size = (300, 300)
        for im in images:
            im.thumbnail(size, Image.ANTIALIAS)

        out = cStringIO.StringIO()

        writeGif(out, images, duration=0.2)
        self.response.headers['Content-Type'] = "image/gif"
        self.response.out.write(out.getvalue())
Beispiel #6
0
    def get(self):
        path = os.path.dirname(__file__)
        file_names = sorted(
            (fn for fn in os.listdir('static') if fn.endswith('.jpeg')))
        print file_names
        images = [
            Image.open("%s/../static/%s" % (path, fn)) for fn in file_names
        ]

        size = (300, 300)
        for im in images:
            im.thumbnail(size, Image.ANTIALIAS)

        out = cStringIO.StringIO()

        writeGif(out, images, duration=0.2)
        self.response.headers['Content-Type'] = "image/gif"
        self.response.out.write(out.getvalue())