change ImageToByteArray to static.

Add check to see if the imageIn equals the resource, if so returns null.
This commit is contained in:
kougyokugentou 2021-01-22 23:16:08 -08:00
parent 76fe5962a1
commit 5ad5e4578c
1 changed files with 4 additions and 1 deletions

View File

@ -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);