nf-photo-collage
Advanced tools
Comparing version 1.3.2 to 1.3.3
31
index.js
@@ -69,15 +69,8 @@ "use strict"; | ||
if(options.backgroundImage != "") { | ||
const bckgBuffer = getPhoto(options.backgroundImage); | ||
bckgBuffer.then((bckg) => { | ||
const image = new Image(); | ||
image.src = bckg; | ||
ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight) | ||
}) | ||
} else { | ||
ctx.fillStyle = options.backgroundColor; | ||
ctx.fillRect(0, 0, canvasWidth, canvasHeight); | ||
} | ||
ctx.fillStyle = options.backgroundColor; | ||
ctx.fillRect(0, 0, canvasWidth, canvasHeight); | ||
const sources = options.sources; | ||
const backgroundSource = options.backgroundImage == "" ? [] : [options.backgroundImage] | ||
const sources = backgroundSource.concat(options.sources); | ||
let maxImages = options.width * options.height; | ||
@@ -89,9 +82,13 @@ | ||
if (i >= maxImages) return; | ||
const img = new Image(); | ||
img.src = photoBuffer; | ||
const x = (i % options.width) * (options.imageWidth + options.spacing); | ||
const y = Math.floor(i / options.width) * (options.imageHeight + options.spacing); | ||
ctx.drawImage(img, x, y, options.imageWidth, options.imageHeight); | ||
if (i == 0 && options.backgroundImage != "") { | ||
// draw background | ||
ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight) | ||
} else { | ||
const x = (i % options.width) * (options.imageWidth + options.spacing); | ||
const y = Math.floor(i / options.width) * (options.imageHeight + options.spacing); | ||
ctx.drawImage(img, x, y, options.imageWidth, options.imageHeight); | ||
} | ||
}) | ||
@@ -98,0 +95,0 @@ .then(() => {}) |
{ | ||
"name": "nf-photo-collage", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10043
142