Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
2a8363e4
Commit
2a8363e4
authored
1 year ago
by
ml bonhomme
Committed by
Erwan Rouchet
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Do not attempt to resize images to dimensions larger than their polygon for thumbnails
parent
b77279e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2215
Do not attempt to resize images to dimensions larger than their polygon for thumbnails
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex/documents/models.py
+3
-1
3 additions, 1 deletion
arkindex/documents/models.py
arkindex/documents/tests/test_element.py
+10
-12
10 additions, 12 deletions
arkindex/documents/tests/test_element.py
with
13 additions
and
13 deletions
arkindex/documents/models.py
+
3
−
1
View file @
2a8363e4
...
...
@@ -656,9 +656,11 @@ class Element(IndexableModel):
if
self
.
mirrored
:
rotation_param
=
f
"
!
{
rotation_param
}
"
# Do no attempt to upsize small images for thumbnails
thumbnail_height
=
min
(
400
,
height
)
return
urljoin
(
self
.
image
.
url
+
"
/
"
,
f
"
{
x
}
,
{
y
}
,
{
width
}
,
{
height
}
/,
400
/
{
rotation_param
}
/default.jpg
"
f
"
{
x
}
,
{
y
}
,
{
width
}
,
{
height
}
/,
{
thumbnail_height
}
/
{
rotation_param
}
/default.jpg
"
)
def
__str__
(
self
):
...
...
This diff is collapsed.
Click to expand it.
arkindex/documents/tests/test_element.py
+
10
−
12
View file @
2a8363e4
...
...
@@ -38,24 +38,22 @@ class TestElement(FixtureTestCase):
def
test_iiif_thumbnail_url
(
self
):
cases
=
[
(
0
,
False
,
"
http://server/img1/10,20,30,40/,400/0/default.jpg
"
),
(
0
,
True
,
"
http://server/img1/10,20,30,40/,400/!0/default.jpg
"
),
(
180
,
False
,
"
http://server/img1/10,20,30,40/,400/180/default.jpg
"
),
(
180
,
True
,
"
http://server/img1/10,20,30,40/,400/!180/default.jpg
"
),
(
0
,
False
,
[[
500
,
100
],
[
650
,
100
],
[
650
,
800
],
[
500
,
800
],
[
500
,
100
]],
"
http://server/img1/500,100,150,700/,400/0/default.jpg
"
),
(
0
,
True
,
[[
500
,
100
],
[
650
,
100
],
[
650
,
800
],
[
500
,
800
],
[
500
,
100
]],
"
http://server/img1/500,100,150,700/,400/!0/default.jpg
"
),
(
180
,
False
,
[[
500
,
580
],
[
650
,
580
],
[
650
,
700
],
[
500
,
700
],
[
500
,
580
]],
"
http://server/img1/500,580,150,120/,120/180/default.jpg
"
),
(
180
,
True
,
[[
500
,
580
],
[
650
,
580
],
[
650
,
700
],
[
500
,
700
],
[
500
,
580
]],
"
http://server/img1/500,580,150,120/,120/!180/default.jpg
"
),
(
0
,
False
,
[[
10
,
20
],
[
40
,
20
],
[
40
,
60
],
[
10
,
60
],
[
10
,
20
]],
"
http://server/img1/10,20,30,40/,40/0/default.jpg
"
),
(
0
,
True
,
[[
10
,
20
],
[
40
,
20
],
[
40
,
60
],
[
10
,
60
],
[
10
,
20
]],
"
http://server/img1/10,20,30,40/,40/!0/default.jpg
"
),
(
180
,
False
,
[[
10
,
20
],
[
40
,
20
],
[
40
,
60
],
[
10
,
60
],
[
10
,
20
]],
"
http://server/img1/10,20,30,40/,40/180/default.jpg
"
),
(
180
,
True
,
[[
10
,
20
],
[
40
,
20
],
[
40
,
60
],
[
10
,
60
],
[
10
,
20
]],
"
http://server/img1/10,20,30,40/,40/!180/default.jpg
"
),
]
for
rotation_angle
,
mirrored
,
expected_url
in
cases
:
for
rotation_angle
,
mirrored
,
polygon
,
expected_url
in
cases
:
with
self
.
subTest
(
rotation_angle
=
rotation_angle
,
mirrored
=
mirrored
):
element
=
Element
(
name
=
"
Something
"
,
type
=
self
.
element_type
,
image
=
self
.
image
,
polygon
=
[
[
10
,
20
],
[
40
,
20
],
[
40
,
60
],
[
10
,
60
],
[
10
,
20
],
],
polygon
=
polygon
,
rotation_angle
=
rotation_angle
,
mirrored
=
mirrored
,
)
...
...
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