PERF: Use cdn when serving site settings upload.

This commit is contained in:
Guo Xiang Tan 2019-05-02 15:35:07 +08:00
parent 24347ace10
commit d5c9ac7196
2 changed files with 8 additions and 2 deletions

View File

@ -35,10 +35,16 @@ export default Ember.Component.extend(UploadMixin, {
}, },
@computed("imageUrl") @computed("imageUrl")
backgroundStyle(url) { imageCDNURL(url) {
if (Ember.isEmpty(url)) { if (Ember.isEmpty(url)) {
return "".htmlSafe(); return "".htmlSafe();
} }
return Discourse.getURLWithCDN(url);
},
@computed("imageCDNURL")
backgroundStyle(url) {
return `background-image: url(${url})`.htmlSafe(); return `background-image: url(${url})`.htmlSafe();
}, },

View File

@ -26,7 +26,7 @@
{{#if imageUrl}} {{#if imageUrl}}
<a class="lightbox" <a class="lightbox"
href={{imageUrl}} href={{imageCDNURL}}
title={{imageFilename}} title={{imageFilename}}
rel="nofollow noopener"> rel="nofollow noopener">