background image fix
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 25 KiB |
@@ -6,4 +6,5 @@ use CodeIgniter\Router\RouteCollection;
|
||||
* @var RouteCollection $routes
|
||||
*/
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->get('/media/test', 'Media::index');
|
||||
$routes->get('/media/test', 'Media::index');
|
||||
$routes->get('/media/show/(:any)', 'Media::imageGate/$1');
|
||||
|
||||
@@ -10,43 +10,118 @@ class Media extends BaseController
|
||||
|
||||
$target_file = "/var/www/html/SITEFILES/TEST/test.jpg";
|
||||
$filename = $target_file;
|
||||
$file_extension = strtolower(substr(strrchr($filename,"."),1));
|
||||
$ctype="image/jpeg";
|
||||
switch( $file_extension ) {
|
||||
case "gif": $ctype="image/gif"; break;
|
||||
case "png": $ctype="image/png"; break;
|
||||
$file_extension = strtolower(substr(strrchr($filename, "."), 1));
|
||||
$ctype = "image/jpeg";
|
||||
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 "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;
|
||||
$selectedFile = $target_file;
|
||||
header('Content-type: ' . $ctype);
|
||||
readfile($selectedFile);
|
||||
exit();
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
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;
|
||||
// echo $target_file;
|
||||
|
||||
// return $target_file;
|
||||
// return $target_file;
|
||||
|
||||
}
|
||||
|
||||
public function imageGate()
|
||||
{
|
||||
$uriSegments = explode("/", parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
|
||||
$segLen = count($uriSegments);
|
||||
//var_dump($uriSegments);
|
||||
|
||||
$filename = $this->imageSets($uriSegments[ $segLen -1 ]);
|
||||
$target_file = "/var/www/html/SITEFILES/TEST/".$filename;
|
||||
$file_extension = strtolower(substr(strrchr($filename, "."), 1));
|
||||
$ctype = "image/jpeg";
|
||||
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;
|
||||
header('Content-type: ' . $ctype);
|
||||
readfile($selectedFile);
|
||||
exit();
|
||||
}
|
||||
|
||||
private function imageSets($selImg)
|
||||
{
|
||||
$image_set = [
|
||||
"test" => "test.jpg",
|
||||
"about8-image" => "about8-image.png",
|
||||
"about7-image" => "about7-image.png",
|
||||
"about6-image1" => "about6-image1.png",
|
||||
"about6-image2" => "about6-image2.png",
|
||||
"about5-image3" => "about5-image3.png",
|
||||
"about5-image2" => "about5-image2.png",
|
||||
"about4-image3" => "about4-image3.png",
|
||||
"about5-image1" => "about5-image1.png",
|
||||
"about3-image1" => "about3-image1.png",
|
||||
"about3-image2" => "about3-image2.png",
|
||||
"about4-image1" => "about4-image1.png",
|
||||
"about10-image" => "about10-image.png",
|
||||
"about2-image1" => "about2-image1.png",
|
||||
"about2-image2" => "about2-image2.png",
|
||||
"about-page-sec1-image1" => "about-page-sec1-image1.png",
|
||||
"about-page-sec1-image2" => "about-page-sec1-image2.png",
|
||||
"about-choose-sec-image2" => "about-choose-sec-image2.png",
|
||||
"about-choose-sec-image3" => "about-choose-sec-image3.png",
|
||||
"about-choose-sec-image1" => "about-choose-sec-image1.png",
|
||||
];
|
||||
return $image_set[$selImg];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||