change ImageToByteArray to static.
Add check to see if the imageIn equals the resource, if so returns null.
This commit is contained in:
parent
76fe5962a1
commit
5ad5e4578c
|
@ -11,11 +11,14 @@ namespace GreatHomeChildcare
|
||||||
* OUPUT byte[] array
|
* OUPUT byte[] array
|
||||||
* https://stackoverflow.com/questions/3801275/how-to-convert-image-to-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)
|
if (imageIn == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (imageIn == Properties.Resources.child)
|
||||||
|
return null;
|
||||||
|
|
||||||
using (var ms = new MemoryStream())
|
using (var ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
imageIn.Save(ms, imageIn.RawFormat);
|
imageIn.Save(ms, imageIn.RawFormat);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user