nf-photo-collage
Advanced tools
Comparing version 1.3.4 to 1.3.5
27
index.js
@@ -72,6 +72,8 @@ "use strict"; | ||
const backgroundSource = options.backgroundImage == "" ? [] : [options.backgroundImage] | ||
const hasBackgroundImage = options.backgroundImage == ""; | ||
const backgroundSource = hasBackgroundImage ? [] : [options.backgroundImage]; | ||
const sources = backgroundSource.concat(options.sources); | ||
let maxImages = options.width * options.height; | ||
if(hasBackgroundImage) maxImages++; | ||
@@ -81,8 +83,3 @@ return Promise | ||
.each((photoBuffer, i) => { | ||
if (options.backgroundImage != "") { | ||
if (i - 1 >= maxImages) return; | ||
} else { | ||
if (i >= maxImages) return; | ||
} | ||
if (i >= maxImages) return; | ||
@@ -92,16 +89,8 @@ const img = new Image(); | ||
// if (options.backgroundImage != "") { | ||
// if (i == 0) { | ||
// // draw background | ||
// ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight) | ||
// } else { | ||
// i--; // offset for first image | ||
// } | ||
// } else { | ||
// } | ||
if (i == 0 && options.backgroundImage != "") { | ||
// draw background image if present | ||
if (hasBackgroundImage && i == 0) { | ||
ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight) | ||
} else { | ||
// offset for background | ||
if (hasBackgroundImage) i--; | ||
const x = (i % options.width) * (options.imageWidth + options.spacing); | ||
@@ -108,0 +97,0 @@ const y = Math.floor(i / options.width) * (options.imageHeight + options.spacing); |
{ | ||
"name": "nf-photo-collage", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"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
10200
146