Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jens Korte
gajim-plugins
Commits
2ff0cbc8
Commit
2ff0cbc8
authored
May 07, 2018
by
Philipp Hörist
Browse files
[preview] Fix bug in ratio calculation
parent
1cf978ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
url_image_preview/url_image_preview.py
View file @
2ff0cbc8
...
...
@@ -19,6 +19,7 @@ import os
import
hashlib
import
binascii
import
logging
import
math
from
urllib.parse
import
urlparse
from
io
import
BytesIO
import
shutil
...
...
@@ -374,11 +375,11 @@ class Base(object):
if
image_width
>
image_height
:
if
image_width
>
size
:
image_height
=
int
(
size
/
float
(
image_width
)
*
image_height
)
image_height
=
math
.
ceil
(
(
size
/
float
(
image_width
)
*
image_height
)
)
image_width
=
int
(
size
)
else
:
if
image_height
>
size
:
image_width
=
int
(
size
/
float
(
image_height
)
*
image_width
)
image_width
=
math
.
ceil
(
(
size
/
float
(
image_height
)
*
image_width
)
)
image_height
=
int
(
size
)
return
image_width
,
image_height
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment