/** * @param Ebook $ebook */ public function preview(Ebook $ebook) { header("Content-type: {$ebook->filemime}"); header('Content-Disposition: inline'); header('Content-Transfer-Encoding: binary'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Expires: 0'); readfile($ebook->filePath()); }