Loading src/jama/__init__.py +1 −1 Original line number Diff line number Diff line __version__ = "0.1.74" __version__ = "0.1.75" src/resources/models.py +13 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,19 @@ class File(Resource): def local_path(self): return hash_to_local_path(self.hash) def iiif_destination_file(self) -> str: if self.should_have_iiif: return "{}{}{}{}{}{}{}".format( settings.IIIF_DIR, os.path.sep, self.hash[:2], os.path.sep, self.hash[2:4], os.path.sep, self.hash, ) return "" def ocr_output(self) -> Union[None, str]: """ Fetch OCR output if available. None if not available. Loading src/resources/views.py +4 −1 Original line number Diff line number Diff line Loading @@ -55,10 +55,13 @@ def thumb( tmp_pic_path = "{}/thumb-{}-{}-{}-{}-{}-{}-{}.jpg".format( settings.TMP_THUMBNAILS_DIR, sha256, angle, scale, top, right, bottom, left ) local_path = pic_file.local_path() if pic_file.file_type.mime == "image/jp2": local_path = pic_file.iiif_destination_file() if not os.path.isfile(tmp_pic_path): crop_color = [96] pyvips.cache_set_max(0) img = pyvips.Image.new_from_file(pic_file.local_path()) img = pyvips.Image.new_from_file(local_path) if angle: img = img.rotate(angle) img = img.draw_rect(crop_color, 0, 0, left, img.height, fill=True) Loading src/rpc/methods.py +4 −1 Original line number Diff line number Diff line Loading @@ -2950,7 +2950,10 @@ def picture_rotate_crop( ) try: pyvips.cache_set_max(0) img = pyvips.Image.new_from_file(file_instance.local_path()) local_path = file_instance.local_path() if file_instance.file_type.mime == "image/jp2": local_path = file_instance.iiif_destination_file() img = pyvips.Image.new_from_file(local_path) if rotation: img = img.rotate(rotation) img = img.extract_area( Loading Loading
src/jama/__init__.py +1 −1 Original line number Diff line number Diff line __version__ = "0.1.74" __version__ = "0.1.75"
src/resources/models.py +13 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,19 @@ class File(Resource): def local_path(self): return hash_to_local_path(self.hash) def iiif_destination_file(self) -> str: if self.should_have_iiif: return "{}{}{}{}{}{}{}".format( settings.IIIF_DIR, os.path.sep, self.hash[:2], os.path.sep, self.hash[2:4], os.path.sep, self.hash, ) return "" def ocr_output(self) -> Union[None, str]: """ Fetch OCR output if available. None if not available. Loading
src/resources/views.py +4 −1 Original line number Diff line number Diff line Loading @@ -55,10 +55,13 @@ def thumb( tmp_pic_path = "{}/thumb-{}-{}-{}-{}-{}-{}-{}.jpg".format( settings.TMP_THUMBNAILS_DIR, sha256, angle, scale, top, right, bottom, left ) local_path = pic_file.local_path() if pic_file.file_type.mime == "image/jp2": local_path = pic_file.iiif_destination_file() if not os.path.isfile(tmp_pic_path): crop_color = [96] pyvips.cache_set_max(0) img = pyvips.Image.new_from_file(pic_file.local_path()) img = pyvips.Image.new_from_file(local_path) if angle: img = img.rotate(angle) img = img.draw_rect(crop_color, 0, 0, left, img.height, fill=True) Loading
src/rpc/methods.py +4 −1 Original line number Diff line number Diff line Loading @@ -2950,7 +2950,10 @@ def picture_rotate_crop( ) try: pyvips.cache_set_max(0) img = pyvips.Image.new_from_file(file_instance.local_path()) local_path = file_instance.local_path() if file_instance.file_type.mime == "image/jp2": local_path = file_instance.iiif_destination_file() img = pyvips.Image.new_from_file(local_path) if rotation: img = img.rotate(rotation) img = img.extract_area( Loading