1
0
mirror of https://github.com/AlexKrunch/AnonIB-3D.git synced 2024-11-29 22:11:50 -05:00
AnonIB-3D/ready2use/srv/img/index.php

29 lines
717 B
PHP
Raw Normal View History

2019-08-17 04:21:07 -04:00
<?php
//Load the DB
require_once "../php/Utils/Constants.php";
$uploaddir = '../php/'.Constants::CONST_IMAGE_UPLOAD_FOLDER.'/';
use Lazer\Classes\Database as Lazer;
define('LAZER_DATA_PATH', '../php/'.realpath(dirname(__FILE__)).'/'.Constants::CONST_DB_FOLDER.'/');
$name = $_GET['name']; // Assuming the file name is in the URL for this example
$parsed = explode("_",$name);
if(count($parsed) != 2) return;
$mapKey = $parsed[0].'/';
$name = $parsed[1];
$ext = pathinfo($name)['extension'];
$mimeType = 'image/'.$ext;
$handle = fopen($uploaddir.$mapKey.$name , "rb");
$contents = fread($handle, filesize($uploaddir.$mapKey.$name ));
fclose($handle);
header("content-type: image/".$ext);
echo $contents;
?>