I have situation where I need to serve image files from PHP for security. Actual image file are stored outside public directory. I have image size, image mime type , name etc. in database .
In simple PHP, could be done using :
if($imageData) {
// array with image details from DB :
// $imageData
/ basic headers
header("Content-type:" . $imageData['mimeType']);
header("Expires: Mon, 1 Jan 2099 05:00:00 GMT");
header("Last-Modified: " . date(DATE_RFC2822 , $imageData['created'] . " GMT");
header("Content-Length: $imageData['size'] bytes");
// output the file contents
readfile($$imageData['full_path']);
} else {
header('HTTP/1.0 404 Not Found');
die();
}
How can achieve this in pure Phalcon way. I know I can disable view rendering but still a proper idea or guide will be helpful. Also, currently I have no plan to use micro application .