Media finder

This commit is contained in:
CHIEFSOFT\ameye
2023-08-10 20:05:44 -04:00
parent 8ac4497206
commit f9b7fb4fe7
4 changed files with 131 additions and 13 deletions
+33 -13
View File
@@ -30,21 +30,41 @@ class WrenchMedia extends BaseController
public function apigate(){
// $file = __DIR__ . DIRECTORY_SEPARATOR . "books.png";
// $fileData = exif_read_data($file);
// ob_start();
// header("Content-Type: " . $fileData["MimeType"]);
// header("Content-Length: " . $fileData["FileSize"]);
// readfile($file);
// ob_end_flush();
$segs = $this->uri->segment_array();
$uriSegments = explode("/", parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
$segLen = count($uriSegments);
echo $segLen;
foreach ($segs as $segment)
{
echo $segment;
echo '<br />';
if ( $segLen < 4 ){
return;
}
$sessionId = $uriSegments[$segLen-3];
$fileSection = $uriSegments[$segLen-2];
$fileUID = $uriSegments[$segLen-1];
$supportedSections = ['profile','myfile','contracts','family'];
if (!in_array($fileSection, $supportedSections)) {
// section not supported
return;
}
/*
* VERIFY ALL PARAMETERS ARE GOOD
*/
//We can check cache for the file or
// OR
// WE need to ask backend for this file now /
$data = [
'action' => WRENCHBOARD_GET_MEDIA,
'sessionid' => $sessionId,
'file_section' => $fileSection,
'file_uid' => $fileUID,
];
$file = 'books.png';
if (file_exists($file)) {