Fix configuration of gd in base images below PHP 7.4 #380
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
imagecreatefromjpeg()
is undefined. This is caused by a change we applied on all images about GD, which actually only valid from PHP 7.4. Although it never failed, the gd extension was not loaded on previous versions.How to test
base/images/7.1-apache
docker build -t prestashop/base:test-7.1-apache .
docker run --rm -ti --entrypoint="php" prestashop/base:test-7.1-apache
gd
library is properly loaded. Paste this code then quit withctrl
+D
orcmd
+D
PHP Fatal error: Uncaught Error: Call to undefined function imagecreatefromjpeg() in -:3
PHP Warning: imagecreatefromjpeg() expects exactly 1 parameter, 0 given in - on line 3
Reported errors:
prestashop_autoupgrade | [Thu Apr 11 16:50:41.395837 2024] [php7:error] [pid 65] [client 192.168.0.1:42770] PHP Fatal error: Uncaught Error: Call to undefined function imagecreatefromjpeg() in /var/www/html/classes/ImageManager.php:533\nStack trace:\n#0 /var/www/html/classes/ImageManager.php(260): ImageManagerCore::create(2, '/var/www/html/i...')\n#1 /var/www/html/src/Adapter/Image/ImageRetriever.php(151): ImageManagerCore::resize('/var/www/html/i...', '/var/www/html/i...', 800, 800)\n#2 /var/www/html/src/Adapter/Image/ImageRetriever.php(80): PrestaShop\\PrestaShop\\Adapter\\Image\\ImageRetriever->getImage(Object(Product), '1')\n#3 [internal function]: PrestaShop\\PrestaShop\\Adapter\\Image\\ImageRetriever->PrestaShop\\PrestaShop\\Adapter\\Image\\{closure}(Array)\n#4 /var/www/html/src/Adapter/Image/ImageRetriever.php(90): array_map(Object(Closure), Array)\n#5 /var/www/html/src/Core/Product/ProductPresenter.php(95): PrestaShop\\PrestaShop\\Adapter\\Image\\ImageRetriever->getProductImages(Array, Object(Language))\n#6 /var/www/html/src/Core/Product/ProductPresenter.php(563): PrestaShop\\PrestaShop\\Core\\Product\\ProductPresenter->fillImages(Array, Object(Presta in /var/www/html/classes/ImageManager.php on line 533