mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-27 07:48:16 -05:00
Corrected an issue where thumbnails had the wrong size.
This commit is contained in:
@@ -370,21 +370,32 @@ class Link(Thing, Printable):
|
||||
item.over_18 = bool(item.over_18 or item.subreddit.over_18 or
|
||||
item.nsfw_str)
|
||||
item.nsfw = item.over_18 and user.pref_label_nsfw
|
||||
|
||||
|
||||
item.rendered_thumbnail_size = (70, 50)
|
||||
|
||||
item.is_author = (user == item.author)
|
||||
|
||||
# always show a promo author their own thumbnail
|
||||
if item.promoted and (user_is_admin or item.is_author) and item.has_thumbnail:
|
||||
item.thumbnail = media.thumbnail_url(item)
|
||||
if(hasattr(item, 'thumbnail_size')):
|
||||
item.rendered_thumbnail_size = item.thumbnail_size
|
||||
else:
|
||||
item.rendered_thumbnail_size = None
|
||||
elif user.pref_no_profanity and item.over_18 and not c.site.over_18:
|
||||
if show_media:
|
||||
item.thumbnail = "/static/nsfw2.png"
|
||||
item.rendered_thumbnail_size = (70, 70)
|
||||
else:
|
||||
item.thumbnail = ""
|
||||
elif not show_media:
|
||||
item.thumbnail = ""
|
||||
elif item.has_thumbnail:
|
||||
item.thumbnail = media.thumbnail_url(item)
|
||||
if hasattr(item, 'thumbnail_size'):
|
||||
item.rendered_thumbnail_size = item.thumbnail_size
|
||||
else:
|
||||
item.rendered_thumbnail_size = None
|
||||
elif item.is_self:
|
||||
item.thumbnail = g.self_thumb
|
||||
else:
|
||||
|
||||
@@ -235,10 +235,10 @@ ${parent.thing_css_class(what)} ${"over18" if thing.over_18 else ""}
|
||||
<%call expr="make_link('thumbnail', 'thumbnail')">
|
||||
​
|
||||
<%
|
||||
if not hasattr(thing, 'thumbnail_size'):
|
||||
if not hasattr(thing, 'rendered_thumbnail_size') or thing.rendered_thumbnail_size is None:
|
||||
size_str = ""
|
||||
else:
|
||||
size_str = "width = '%d' height = '%d'" % (thing.thumbnail_size[0], thing.thumbnail_size[1])
|
||||
size_str = "width='%d' height='%d'" % (thing.rendered_thumbnail_size[0], thing.rendered_thumbnail_size[1])
|
||||
%>
|
||||
<img src="${s3_https_if_secure(thing.thumbnail)}" ${size_str} alt=""/>
|
||||
</%call>
|
||||
|
||||
Reference in New Issue
Block a user