Skip to content

Commit

Permalink
Re #11: Fix thumb width calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
peterlevi committed Jun 25, 2018
1 parent 059c007 commit 78df52f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions data/browse.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
</head>

<body>
<div id="spinner">
<img src="img/spinner.gif" class="spinner">
</div>
<div id="main">
<div class="search">
<input type="search" id="search-field">
Expand Down
2 changes: 1 addition & 1 deletion data/browse.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function add_image(file, thumb) {
var item = $(".item[file='" + encode_path(file) + "']");
if (item.length) {
item.html(
"<div style='display: table-cell; vertical-align: middle; text-align: center; width:60px; height:" + thumb_height + "px;'>" +
"<div style='display: table-cell; vertical-align: middle; text-align: center; width:10px; height:" + thumb_height + "px;'>" +
"<div style='display: inline-block'>" +
"<img style='max-height: " + thumb_height + "px;' src='" + encode_path(thumb) + "'/>" +
"</div>" +
Expand Down
4 changes: 2 additions & 2 deletions ojo/ojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ def _prepare_thread():
util.path2url(img),
os.path.basename(img),
'true' if img == self.selected else 'false',
180))
options['thumb_height'] * 3/2))
time.sleep(0.001)
cached = self.thumbs.get_cached_thumbnail_path(img)
if os.path.exists(cached):
Expand All @@ -700,7 +700,7 @@ def _prepare_thread():
meta = metadata.get_full(img)
w, h = meta.dimensions
rok = not needs_rotation(meta)
thumb_width = round(w * thumbh / h) if rok else round(h * thumbh / w)
thumb_width = int(float(w) * thumbh / h) if rok else int(float(h) * thumbh / w)
if w and h:
self.js("set_dimensions('%s', '%s', '%d x %d', %d)" % (
util.path2url(img),
Expand Down

0 comments on commit 78df52f

Please sign in to comment.