# HG changeset patch # User Matti Hamalainen # Date 1585920300 -10800 # Node ID b816e80bc002e154eda1d75d7c1f41fc37e07d5b # Parent da150fe627b6ef9df718fd417b9cfcbfe57abed8 Add a check for that we are running on PHP 7.1 or later if WebP format images are being used. diff -r da150fe627b6 -r b816e80bc002 mgallery.inc.php --- 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; }