in reply to encode/decode images

I agree with samtregar - putting images in a database is a bad idea. Store "pointers" to the files (file paths, etc.), along with other meta-data, if you want to be able to search for specific groups of images.

But if you really want to do it anyway - just use the 'blob' datatype - that's what it's for. Just read the thumbnail image into a string (slurp the file), then write it to the database like any other string. Just don't try to view it in the mysql client! And keep all the blob data in a table of its own, else you'll kill the performance of other database queries.