PERF: Use cdn when serving site settings upload.

PERF: Use cdn when serving site settings upload.

diff --git a/app/assets/javascripts/discourse/components/image-uploader.js.es6 b/app/assets/javascripts/discourse/components/image-uploader.js.es6
index 234de6e..ec52913 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 716f4c6..4c9b410 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}}
     <a class="lightbox"
-       href={{imageUrl}}
+       href={{imageCDNURL}}
        title={{imageFilename}}
        rel="nofollow noopener">

GitHub sha: d5c9ac71

1 Like