Don't store images in Base64 in your DB - it's very inefficient and images are big enough to start with that it's often a bad idea to store them at all. Small numbers of Thumbnails (or thumb sized images) OK - but full sized images or large quantities and you start to slow everything down dramatically. A better idea is to store them in binary using a BLOB / IMAGE / VARBINARY column, or even better store a path to the file in the DB, and access the image that from that as necessary.
Inserting binary data is simple - provided you use parameterized queries which should always do anyway - you'll find the code here:
Why do I get a "Parameter is not valid." exception when I read an image from my database?[
^]