From d5c9ac7196e84e4b89ae783f52f367476ba671a0 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 2 May 2019 15:35:07 +0800 Subject: [PATCH] PERF: Use cdn when serving site settings upload. --- .../discourse/components/image-uploader.js.es6 | 8 +++++++- .../discourse/templates/components/image-uploader.hbs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/components/image-uploader.js.es6 b/app/assets/javascripts/discourse/components/image-uploader.js.es6 index 234de6e8434..ec52913c99f 100644 --- a/app/assets/javascripts/discourse/components/image-uploader.js.es6 +++ b/app/assets/javascripts/discourse/components/image-uploader.js.es6 @@ -35,10 +35,16 @@ export default Ember.Component.extend(UploadMixin, { }, @computed("imageUrl") - backgroundStyle(url) { + imageCDNURL(url) { if (Ember.isEmpty(url)) { return "".htmlSafe(); } + + return Discourse.getURLWithCDN(url); + }, + + @computed("imageCDNURL") + backgroundStyle(url) { return `background-image: url(${url})`.htmlSafe(); }, diff --git a/app/assets/javascripts/discourse/templates/components/image-uploader.hbs b/app/assets/javascripts/discourse/templates/components/image-uploader.hbs index 716f4c646a6..4c9b410290d 100644 --- a/app/assets/javascripts/discourse/templates/components/image-uploader.hbs +++ b/app/assets/javascripts/discourse/templates/components/image-uploader.hbs @@ -26,7 +26,7 @@ {{#if imageUrl}}