diff --git a/arkindex_worker/models.py b/arkindex_worker/models.py index d79495a672102c41a371e760066c817b0565ec56..a65b4466eae36abab19c2f80401811ba9c4f178f 100644 --- a/arkindex_worker/models.py +++ b/arkindex_worker/models.py @@ -187,20 +187,9 @@ class Element(MagicDict): if max_width is None and max_height is None: resize = "full" else: - bounding_box = polygon_bounding_box(self.zone.polygon) original_size = {"w": self.zone.image.width, "h": self.zone.image.height} - # No resizing if the element is smaller than the image. - if ( - bounding_box.width != original_size["w"] - or bounding_box.height != original_size["h"] - ): - resize = "full" - logger.warning( - "Only full image size elements covered, " - + "downloading full size image." - ) # No resizing if the image is smaller than the wanted size. - elif (max_width is None or original_size["w"] <= max_width) and ( + if (max_width is None or original_size["w"] <= max_width) and ( max_height is None or original_size["h"] <= max_height ): resize = "full" diff --git a/tests/test_element.py b/tests/test_element.py index 734d5c81540841ab0ccf370b53053e573b30e792..0f3015292ce8dc1fb199041f1cbd8a8c544cf746 100644 --- a/tests/test_element.py +++ b/tests/test_element.py @@ -141,7 +141,7 @@ def test_open_image_resize_partial_element(mocker): assert elt.open_image(max_height=400, use_full_image=True) == "an image!" assert open_mock.call_count == 1 assert open_mock.call_args == mocker.call( - "http://something/full/full/0/default.jpg", + "http://something/full/,400/0/default.jpg", rotation_angle=0, mirrored=False, )