background image fix

This commit is contained in:
CHIEFSOFT\ameye
2025-11-28 20:14:02 -05:00
parent 9ec46965e9
commit c4c6e068a5
21 changed files with 102 additions and 26 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+1
View File
@@ -7,3 +7,4 @@ use CodeIgniter\Router\RouteCollection;
*/ */
$routes->get('/', 'Home::index'); $routes->get('/', 'Home::index');
$routes->get('/media/test', 'Media::index'); $routes->get('/media/test', 'Media::index');
$routes->get('/media/show/(:any)', 'Media::imageGate/$1');
+80 -5
View File
@@ -13,12 +13,22 @@ class Media extends BaseController
$file_extension = strtolower(substr(strrchr($filename, "."), 1)); $file_extension = strtolower(substr(strrchr($filename, "."), 1));
$ctype = "image/jpeg"; $ctype = "image/jpeg";
switch ($file_extension) { switch ($file_extension) {
case "gif": $ctype="image/gif"; break; case "gif":
case "png": $ctype="image/png"; break; $ctype = "image/gif";
break;
case "png":
$ctype = "image/png";
break;
case "jpeg": case "jpeg":
case "jpg": $ctype="image/jpeg"; break; case "jpg":
case "svg": $ctype="image/svg+xml"; break; $ctype = "image/jpeg";
case "mp4": $ctype="application/octet-stream"; break; break;
case "svg":
$ctype = "image/svg+xml";
break;
case "mp4":
$ctype = "application/octet-stream";
break;
// case "mp4": $ctype="video/mp4"; break; // case "mp4": $ctype="video/mp4"; break;
default: default:
} }
@@ -49,4 +59,69 @@ class Media extends BaseController
// 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];
}
} }