I wan't to implement a module, that can store images in the database and display them in tags. The only way I know to do that is to store base64 encoded images, load them, decode and send as an HTTP response when browser requests URL from the tag.
Like this:
Code: Select all
header("Content-type: ".$record['type']);
header("Content-length: ".$record['size']);
header("Content-Disposition: attachment; filename=".$record['name']);
header("Content-Description: Attachment");
echo base64_decode($record['content']);
Is there a way to do it from a module? Because as far as I know modules only insert their content into a template. How to send just this HTTP response?
Alternatively - what would be the best place in CMSMS to implement such a response while at the same time using the db connection or any other required stuff already in CMSMS?
Thanks,
Matt.


