FIX: Use CDN for optimized loading images. (#7006)

We missed a few spots in the cooked post processor where images where not loaded using CDN, causing
uneeded load and requests against the server
This commit is contained in:
Dan Ungureanu
2019-02-20 04:55:08 +02:00
committed by Sam
parent da1ff2da2c
commit 10dad7d013
2 changed files with 26 additions and 13 deletions

View File

@ -389,7 +389,7 @@ class CookedPostProcessor
if upload
thumbnail = upload.thumbnail(w, h)
if thumbnail && thumbnail.filesize.to_i < upload.filesize
img["src"] = thumbnail.url
img["src"] = UrlHelper.cook_url(thumbnail.url)
srcset = +""
@ -408,11 +408,11 @@ class CookedPostProcessor
img["srcset"] = "#{UrlHelper.cook_url(img["src"])}#{srcset}" if srcset.present?
end
else
img["src"] = upload.url
img["src"] = UrlHelper.cook_url(upload.url)
end
if small_upload = loading_image(upload)
img["data-small-upload"] = small_upload.url
img["data-small-upload"] = UrlHelper.cook_url(small_upload.url)
end
end