From 5ad5e4578c8f05b7299fa3d57d5fbb3b58478d82 Mon Sep 17 00:00:00 2001 From: kougyokugentou <41278462+kougyokugentou@users.noreply.github.com> Date: Fri, 22 Jan 2021 23:16:08 -0800 Subject: [PATCH] change ImageToByteArray to static. Add check to see if the imageIn equals the resource, if so returns null. --- ImageWrangler.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ImageWrangler.cs b/ImageWrangler.cs index 841e923..9682a27 100644 --- a/ImageWrangler.cs +++ b/ImageWrangler.cs @@ -11,11 +11,14 @@ namespace GreatHomeChildcare * OUPUT byte[] array * https://stackoverflow.com/questions/3801275/how-to-convert-image-to-byte-array */ - public byte[] ImageToByteArray(Image imageIn) + public static byte[] ImageToByteArray(Image imageIn) { if (imageIn == null) return null; + if (imageIn == Properties.Resources.child) + return null; + using (var ms = new MemoryStream()) { imageIn.Save(ms, imageIn.RawFormat);