In a system we fetch emails automatically and save the attachments in these emails in database. Now the customer want to be able to not save certain images, like banners and such that get saved over and over again.
I need a way to create a "blacklist" of images in the database and compare these images to the incoming attachments.
this is how the attachments are saved to database.
....
InputStream is = new BufferedInputStream(new FileInputStream(attachment));
preparedStatement.setBinaryStream(5,is,(int)filesize);
....
pstmt.executeUpdate();
In the database they get saved as image and looks like 0xFFD8FFE000104A46494600010100000100010000....
What would be an easy way to read a few such images from database and see if any of them are identical to the incoming attachment?
Note that this is a rather complex system that I will not be able to rebuild at this time. So any advice about storing images in folders instead of in database or something similar will not be helpful to me right now.