Mercurial > hg > mgallery
changeset 305:b816e80bc002
Add a check for that we are running on PHP 7.1 or later if WebP format images are being used.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 03 Apr 2020 16:25:00 +0300 |
parents | da150fe627b6 |
children | 2c5ff6aa9845 |
files | mgallery.inc.php |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mgallery.inc.php Fri Apr 03 16:24:06 2020 +0300 +++ b/mgallery.inc.php Fri Apr 03 16:25:00 2020 +0300 @@ -208,9 +208,20 @@ function mgGetAlbumSetting(&$data, $key, $default = NULL) { if (array_key_exists($key, $data)) - return $data[$key]; + $val = $data[$key]; else - return mgGetSetting($key, $default); + $val = mgGetSetting($key, $default); + + // XXX This is a rather silly place for this check, but since any album can + // set their own formats, we can't do this check globally without scanning + // all the sub-albums etc .. maybe we'll do that some day. + if (($key == "tn_format" || $key == "med_format") && + $val == "webp" && version_compare(PHP_VERSION, "7.1.0") < 0) + { + die("ERROR: WEBP image format support requires PHP version 7.1 or later."); + } + + return $val; }