diff --git a/oml/item/handlers.py b/oml/item/handlers.py index 8f892b5..901e579 100644 --- a/oml/item/handlers.py +++ b/oml/item/handlers.py @@ -100,9 +100,8 @@ class CropHandler(OMLHandler): with db.session(): item = Item.get(id) path = item.get_path() - print(path, page, left, top, right, bottom) data = crop(path, page, left, top, right, bottom) - if data: + if path and data: self.set_header('Content-Type', 'image/jpeg') self.set_header('Content-Length', str(len(data))) self.write(data) diff --git a/oml/media/pdf.py b/oml/media/pdf.py index 96d27ed..2f58d9a 100644 --- a/oml/media/pdf.py +++ b/oml/media/pdf.py @@ -105,7 +105,6 @@ def crop(pdf, page, left, top, right, bottom): if image: image = image[0] crop = [int(p) for p in (left, top, right, bottom)] - print(crop) img = Image.open(image).crop(crop) img.save(image) with open(image, 'rb') as fd: