First commit. Implement a very basic CDN server to serve and resize images
This commit is contained in:
commit
9907bde834
10 files changed
+1333
No files matched your search
@@ -0,0 +1,20 @@
|
||||
<?php declare(strict_types=1);
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
|
||||
require_once './vendor/autoload.php';
|
||||
|
||||
use ImageResizer\Lib\Resizer;
|
||||
use ImageResizer\Lib\SqliteImageDb;
|
||||
use ImageResizer\Models\ResizeParams;
|
||||
|
||||
$dotenv = Dotenv\Dotenv::createImmutable([__DIR__, __DIR__ . "/.."]);
|
||||
$dotenv->load();
|
||||
|
||||
$imageDb = new SqliteImageDb(new PDO("sqlite:{$_ENV["db_name"]}"));
|
||||
|
||||
$imgPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
$params = new ResizeParams($_GET);
|
||||
|
||||
$resizer = new Resizer($imageDb);
|
||||
|
||||
echo $resizer->performResize($imgPath, $params);
|
||||
Reference in new issue
Block a user