updated file HEADER-sending
This commit is contained in:
parent
6ad48f80a7
commit
ce7d5305e8
@ -21,7 +21,10 @@ class files {
|
||||
if (!in_array($id, $folder)) {
|
||||
throw new \SYSTEM\LOG\ERROR("No matching ID '" . $id . "' found.");}
|
||||
|
||||
\SYSTEM\HEADER::PNG();
|
||||
$ext = pathinfo(self::$folders[$cat].$id);
|
||||
$ext = strtoupper(array_key_exists('extension', $ext) ? $ext['extension'] : '');
|
||||
if(\SYSTEM\HEADER::available($ext)){
|
||||
call_user_func('\SYSTEM\HEADER::'.$ext);}
|
||||
return file_get_contents(self::$folders[$cat].$id);
|
||||
}
|
||||
|
||||
|
||||
@ -15,10 +15,21 @@ class HEADER {
|
||||
public static function JSON(){
|
||||
if(self::checkHeader()){
|
||||
header('Access-Control-Allow-Origin: *');//allow cross domain calls
|
||||
header('content-type: application/json');}
|
||||
}
|
||||
header('content-type: application/json');}}
|
||||
public static function PNG(){
|
||||
if(self::checkHeader()){
|
||||
header('content-type:image/png;');}
|
||||
}
|
||||
header('content-type:image/png;');}}
|
||||
public static function JPG(){
|
||||
if(self::checkHeader()){
|
||||
header('content-type:image/jpeg;');}}
|
||||
public static function JPEG(){
|
||||
if(self::checkHeader()){
|
||||
header('content-type:image/jpeg;');}}
|
||||
public static function GIF(){
|
||||
if(self::checkHeader()){
|
||||
header('content-type:image/gif;');}}
|
||||
|
||||
public static function available($datatype){
|
||||
$datatype = strtoupper($datatype);
|
||||
return \method_exists('\SYSTEM\HEADER', $datatype);}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user