Mysql image storage issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cap2cap10
Forum Contributor
Posts: 158
Joined: Mon Apr 14, 2008 11:06 pm

Mysql image storage issue

Post by cap2cap10 »

Greetings again, members of the PHP Technorati. Ok I am currently trying to discover how to encrypt image (jpeg or png) and store it in the mysql db. So is it possible for mysql to encrypt an uploaded image using AES or does php have to be used to encrypt the image and then store it in the db with out the use of AES?

Desperately need a code sample for this. Dealing with HIPAA law requirements. :banghead:

Thanks in advance,

Batoe

PS: The road to success is filled with obstacles,....but also success!!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Mysql image storage issue

Post by requinix »

MySQL can do AES encryption, but you would be sending the image data unencrypted and thus sniffable (unless you're using SSL).

Personally I'd do the encryption in PHP. Much more control that way.
User avatar
cap2cap10
Forum Contributor
Posts: 158
Joined: Mon Apr 14, 2008 11:06 pm

Re: Mysql image storage issue

Post by cap2cap10 »

Found a PHP AES class that encrypts and decrypts images, allowing for storage in Database. Thanks again.

Batoe :P :drunk:
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Mysql image storage issue

Post by pickle »

I strongly recommend you don't store the image file in the database. It'll absolutely murder your page generation times.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: Mysql image storage issue

Post by Pazuzu156 »

pickle wrote:I strongly recommend you don't store the image file in the database. It'll absolutely murder your page generation times.
Agreed, it's just impractical. Rather store meta data for the image in the database and the image on the server.
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
Post Reply