Media finder
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user