FIX: Ensure no image downloads during topic thumbnail serialization
If image uploads are missing a width/height, we re-download them to update the width/height in the database. However, this takes significant resources so we don't want to run this logic during topic serialization.
This commit is contained in:
parent
918bd75909
commit
f968155288
|
@ -42,7 +42,7 @@ class Topic < ActiveRecord::Base
|
|||
|
||||
def filtered_topic_thumbnails(extra_sizes: [])
|
||||
return nil unless original = image_upload
|
||||
return nil unless original.width && original.height
|
||||
return nil unless original.read_attribute(:width) && original.read_attribute(:height)
|
||||
|
||||
thumbnail_sizes = Topic.thumbnail_sizes + extra_sizes
|
||||
topic_thumbnails.filter { |record| thumbnail_sizes.include?([record.max_width, record.max_height]) }
|
||||
|
@ -50,7 +50,7 @@ class Topic < ActiveRecord::Base
|
|||
|
||||
def thumbnail_info(enqueue_if_missing: false, extra_sizes: [])
|
||||
return nil unless original = image_upload
|
||||
return nil unless original.width && original.height
|
||||
return nil unless original.read_attribute(:width) && original.read_attribute(:height)
|
||||
|
||||
infos = []
|
||||
infos << { # Always add original
|
||||
|
|
Loading…
Reference in New Issue