From a0fbf3931f22b677a5045fb2392f6fa9714ca478 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 5 Oct 2017 22:03:55 +0200 Subject: [PATCH] thumb: dynamic image relay with resize option Generate image with requested height from data source, which should be bypassed by the server if target file exists. Copied from Lijtweg at commit v2.5-58-gac5434f0af (2017-12-12). --- thumb/.gitignore | 1 + thumb/.htaccess | 3 +++ thumb/index.php | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 thumb/.gitignore create mode 100644 thumb/.htaccess create mode 100644 thumb/index.php diff --git a/thumb/.gitignore b/thumb/.gitignore new file mode 100644 index 0000000..34bbc9f --- /dev/null +++ b/thumb/.gitignore @@ -0,0 +1 @@ +/[1-9]*/ diff --git a/thumb/.htaccess b/thumb/.htaccess new file mode 100644 index 0000000..c63c79e --- /dev/null +++ b/thumb/.htaccess @@ -0,0 +1,3 @@ + + Header set Cache-Control "max-age=2628000, immutable" + diff --git a/thumb/index.php b/thumb/index.php new file mode 100644 index 0000000..b49ca6e --- /dev/null +++ b/thumb/index.php @@ -0,0 +1,34 @@ +&1"); + if ($return) { + http_response_code(500); + trigger_error("thumbnail creation failed: $return", E_USER_WARNING); + exit; + } +} + +header('Content-type: '.mime_content_type($target)); +readfile($target); +exit; -- 2.30.0