Ejemplo n.º 1
0
 def write_thumbnails(self, appstruct):
     """ Create the output filenames and generate the top and mosaic
     thumbnails and write them to disk.
     """
     slugser = slugify(appstruct["serial"])
     pdf_filename = "thumbnails/%s/uploaded.pdf" % slugser
     top_file = "thumbnails/%s/top.png" % slugser
     mos_file = "thumbnails/%s/mosaic.png" % slugser
                     
     thumg = ThumbnailGenerator(pdf_filename)
     self.save_blob(thumg.top_thumbnail(), top_file)
     self.save_blob(thumg.mosaic_thumbnail(), mos_file)
Ejemplo n.º 2
0
    def write_thumbnails(self, appstruct):
        """ Create the output filenames and generate the top and mosaic
        thumbnails and write them to disk.
        """
        slugser = slugify(appstruct["serial"])
        pdf_filename = "thumbnails/%s/uploaded.pdf" % slugser
        top_file = "thumbnails/%s/top.png" % slugser
        mos_file = "thumbnails/%s/mosaic.png" % slugser

        thumg = ThumbnailGenerator(pdf_filename)
        self.save_blob(thumg.top_thumbnail(), top_file)
        self.save_blob(thumg.mosaic_thumbnail(), mos_file)
Ejemplo n.º 3
0
 def test_top_page_thumbnail_from_pdf(self):
     filename = "resources/known_unittest.pdf"
     thumg = ThumbnailGenerator(filename)
     png_img = thumg.top_thumbnail()
     img_size = len(png_img)
     self.assertTrue(size_range(img_size, 105238, ok_range=5000))