Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 image to ByteArray to GUID

Author  Topic 

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2012-10-02 : 23:21:56
Greetings,

We ingest a lot of images from external sources. I would like to assure that already ingested images are not re-ingested in the backend. For this I was thinking of generating a GUID based on image's stream as follows

File.ReadAllBytes()

or

public byte[] imageToByteArray(System.Drawing.Image imageIn)
{
MemoryStream ms = new MemoryStream();
imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);
return ms.ToArray();
}
I was then thinking of making this into a CLR (if at all necessary) then save the GUID with the metadata of the image in SQL server. Not sure how accurately unique that GUID would be.

Any inputs?

Thanks

<><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
   

- Advertisement -