Fix for single source multi position images

main
exsersewo 2 years ago
parent c91d3975b7
commit 874dc64ea1
Signed by: exsersewo
GPG Key ID: 9C6DDF9AC9BA14A0
  1. 13
      src/Managers/ImageManager.Generation.cs

@ -35,7 +35,7 @@ public static partial class ImageManager
}
string variant = null;
if (endpoint.Variants.Any() && TrueRandom.Next(0, 50) > 25)
if (endpoint.Variants != null && endpoint.Variants.Any() && TrueRandom.Next(0, 50) > 25)
{
variant = endpoint.Variants.Random().Name;
}
@ -145,9 +145,11 @@ public static partial class ImageManager
}
int img = 0;
foreach (var src in sources)
for(int x = 0; x < template.Positions.Count; x++)
{
var position = template.Positions.ElementAtOrDefault(img);
var position = template.Positions.ElementAtOrDefault(x);
var src = sources.ElementAtOrDefault(img);
Stream imageData = null;
if (File.Exists(src))
@ -176,7 +178,10 @@ public static partial class ImageManager
image.Composite(tmp, Gravity.Northwest, position.X, position.Y, CompositeOperator.Over);
img++;
if (img + 1 < sources.Count())
{
img++;
}
}
return;

Loading…
Cancel
Save