Use larger thumbnail rather than smaller.

This commit is contained in:
Erik Johnston 2016-01-05 17:30:30 +00:00
parent 90921981be
commit 8737ead008

View File

@ -248,6 +248,7 @@ class ThumbnailResource(BaseMediaResource):
if desired_method.lower() == "crop": if desired_method.lower() == "crop":
info_list = [] info_list = []
info_list2 = []
for info in thumbnail_infos: for info in thumbnail_infos:
t_w = info["thumbnail_width"] t_w = info["thumbnail_width"]
t_h = info["thumbnail_height"] t_h = info["thumbnail_height"]
@ -258,12 +259,20 @@ class ThumbnailResource(BaseMediaResource):
size_quality = abs((d_w - t_w) * (d_h - t_h)) size_quality = abs((d_w - t_w) * (d_h - t_h))
type_quality = desired_type != info["thumbnail_type"] type_quality = desired_type != info["thumbnail_type"]
length_quality = info["thumbnail_length"] length_quality = info["thumbnail_length"]
if t_w >= d_w or t_h >= d_h:
info_list.append(( info_list.append((
aspect_quality, min_quality, size_quality, type_quality, aspect_quality, min_quality, size_quality, type_quality,
length_quality, info length_quality, info
)) ))
else:
info_list2.append((
aspect_quality, min_quality, size_quality, type_quality,
length_quality, info
))
if info_list: if info_list:
return min(info_list)[-1] return min(info_list)[-1]
else:
return min(info_list2)[-1]
else: else:
info_list = [] info_list = []
info_list2 = [] info_list2 = []