Skip to content

Commit 86e0f82

Browse files
authored
Merge pull request #81 from BuildFire/adjust-image-cdn
feat/ use imgix for resizing image
2 parents 95909db + b7f409f commit 86e0f82

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/widget/widget.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const Layouts = {
44
1: 'WideScreen',
55
2: 'Cinema'
66
}
7+
const resizeImage = (image,options) =>{
8+
return buildfire.imageLib.resizeImage(
9+
image, options);
10+
}
711

812
const defaultData = {
913
content: {
@@ -77,11 +81,10 @@ function render() {
7781

7882
// Set background image if needed
7983
if (design && design.backgroundImage) {
84+
8085
const width = Math.ceil(state.width);
8186
const height = Math.ceil(state.height);
82-
83-
const baseUrl = 'https://czi3m2qn.cloudimg.io/cdn/n/n';
84-
const url = `${baseUrl}/${design.backgroundImage}?h=${height}&w=${width}`;
87+
const url = resizeImage(design.backgroundImage, { width, height });
8588

8689
window.document.body.setAttribute('style', `
8790
background-size: cover !important;

0 commit comments

Comments
 (0)