background image fix
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Controllers;
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use JetBrains\PhpStorm\NoReturn;
|
||||||
|
|
||||||
class Media extends BaseController
|
class Media extends BaseController
|
||||||
{
|
{
|
||||||
public function index(): void
|
public function index(): void
|
||||||
@@ -39,35 +41,16 @@ class Media extends BaseController
|
|||||||
exit();
|
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;
|
|
||||||
|
|
||||||
// return $target_file;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function imageGate()
|
#[NoReturn] public function imageGate(): void
|
||||||
{
|
{
|
||||||
$uriSegments = explode("/", parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
|
$uriSegments = explode("/", parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
|
||||||
$segLen = count($uriSegments);
|
$segLen = count($uriSegments);
|
||||||
//var_dump($uriSegments);
|
//var_dump($uriSegments);
|
||||||
|
|
||||||
$filename = $this->imageSets($uriSegments[ $segLen -1 ]);
|
$filename = $this->imageSets($uriSegments[$segLen - 1]);
|
||||||
$target_file = "/var/www/html/SITEFILES/TEST/".$filename;
|
$target_file = "/var/www/html/SITEFILES/TEST/" . $filename;
|
||||||
$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) {
|
||||||
@@ -97,10 +80,11 @@ class Media extends BaseController
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function imageSets($selImg)
|
private function imageSets($selImg): string
|
||||||
{
|
{
|
||||||
$image_set = [
|
$image_set = [
|
||||||
"test" => "test.jpg",
|
"test" => "test.jpg",
|
||||||
|
"about-kintcare" => "about-kintcare.png",
|
||||||
"about8-image" => "about8-image.png",
|
"about8-image" => "about8-image.png",
|
||||||
"about7-image" => "about7-image.png",
|
"about7-image" => "about7-image.png",
|
||||||
"about6-image1" => "about6-image1.png",
|
"about6-image1" => "about6-image1.png",
|
||||||
|
|||||||
Reference in New Issue
Block a user