FEATURE: Allow pausing animated images in posts (#12795)

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
Penar Musaraj
2021-04-22 11:28:35 -04:00
committed by GitHub
parent 1e9301d4d8
commit c11d75da87
4 changed files with 90 additions and 2 deletions

View File

@ -318,6 +318,12 @@ class CookedPostProcessor
return
end
upload = Upload.get_from_url(src)
if upload.present? && upload.animated?
img.add_class("animated")
end
return if original_width <= SiteSetting.max_image_width && original_height <= SiteSetting.max_image_height
user_width, user_height = [original_width, original_height] if user_width.to_i <= 0 && user_height.to_i <= 0
@ -332,7 +338,6 @@ class CookedPostProcessor
width, height = ImageSizer.resize(width, height)
end
upload = Upload.get_from_url(src)
if upload.present?
upload.create_thumbnail!(width, height, crop: crop)