Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Base Worker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Workers
Base Worker
Commits
935b2493
Unverified
Commit
935b2493
authored
1 year ago
by
Yoann Schneider
Browse files
Options
Downloads
Patches
Plain Diff
Allow resizing sub elements
parent
9fbb705a
No related branches found
No related tags found
1 merge request
!396
Allow resizing sub elements
Pipeline
#132035
failed
1 year ago
Stage: test
Stage: build
Stage: release
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex_worker/models.py
+1
-12
1 addition, 12 deletions
arkindex_worker/models.py
tests/test_element.py
+1
-1
1 addition, 1 deletion
tests/test_element.py
with
2 additions
and
13 deletions
arkindex_worker/models.py
+
1
−
12
View file @
935b2493
...
...
@@ -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.
el
if
(
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
"
...
...
This diff is collapsed.
Click to expand it.
tests/test_element.py
+
1
−
1
View file @
935b2493
...
...
@@ -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
,
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment