background image fix
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 391 KiB |
@@ -6,3 +6,4 @@ use CodeIgniter\Router\RouteCollection;
|
||||
* @var RouteCollection $routes
|
||||
*/
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->get('/media/test', 'Media::index');
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
class Media extends BaseController
|
||||
{
|
||||
public function index(): void
|
||||
{
|
||||
|
||||
|
||||
$target_file = "/var/www/html/SITEFILES/TEST/test.jpg";
|
||||
$filename = $target_file;
|
||||
$file_extension = strtolower(substr(strrchr($filename,"."),1));
|
||||
switch( $file_extension ) {
|
||||
case "gif": $ctype="image/gif"; break;
|
||||
case "png": $ctype="image/png"; break;
|
||||
case "jpeg":
|
||||
case "jpg": $ctype="image/jpeg"; break;
|
||||
case "svg": $ctype="image/svg+xml"; break;
|
||||
case "mp4": $ctype="application/octet-stream"; break;
|
||||
// case "mp4": $ctype="video/mp4"; break;
|
||||
default:
|
||||
}
|
||||
$selectedFile = $target_file;
|
||||
if (file_exists($selectedFile)) {
|
||||
log_message('critical', "FILE ************************** --->0002");
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="'.basename($selectedFile).'"');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize($selectedFile));
|
||||
readfile($selectedFile);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// echo $target_file;
|
||||
|
||||
// return $target_file;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -57,24 +57,14 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- HEADER: MENU + HEROE SECTION -->
|
||||
<header>
|
||||
<div class="heroe">
|
||||
<h1>MERMS-Media </h1>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
<!-- CONTENT -->
|
||||
|
||||
|
||||
<!-- FOOTER: DEBUG INFO + COPYRIGHTS -->
|
||||
|
||||
<footer>
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user