Publishing images to mysql db

I’m trying to publish images to a BLOB field in a mysql database.

I have the shared image fields implemented and in my database publishing template I have the following source and binding.

<columndef action=“c” limitSizeForIndex=“n” name=“img1”>

$row.img1= $sys.item.getProperty(‘rx:img1’)
$row.$encoding.img1 = ‘base64’

Does anyone have experience publishing binary files to a database?




We publish images to a MS SQL database without problems. We have the following difference in the bindings vs what you posted

$row.ImageContent = $sys.item.getProperty(‘rx:image’).getValue()
$row.$encoding.ImageContent = “base64”

It seems the main difference is the call to getValue() in the bindings. Hope that helps.


Although publishing to DB is ok, performance-wise not the best choice - it would be much better if you publish the images and other binary data to the filesystem or better CDN, while publishing the location path to the DB column instead of dumping all in DB -this is very easy and good for the DB as well.