Problem/Motivation

The image module does not test the PHP platform for library support of image types the module supports. This has affected a few site owners after upgrading to PHP builds that were not compiled with support for some image types.

Proposed resolution

Change the toolkit's getRequirements() method to detect the actually available image formats as reported by gd_info(); add a string to the UI of the status report under 'GD Library' to report the actually supported image formats; add testing.

Remaining tasks

User interface changes

Screenshots taken from the status report page

Current UI (no color module installed)

New UI

ALL GOOD

One format missing

Two formats missing

API changes

Data model changes

Release notes snippet


Original report

Hi,
I installed media and media library.
I am on an Ubuntu PC with docker environement for my Drupla 8.8.2 install.
(PHP 7.3.14, Apache 2.4.38, MySql 5.7.29)

When I try to upload an image I get this error:

Warning: imagesx() expects parameter 1 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php).
Warning: imagesy() expects parameter 1 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php).
Warning: imagecopyresampled() expects parameter 2 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php).
Warning: imagesx(): supplied resource is not a valid Image resource in Drupal\system\Plugin\ImageToolkit\GDToolkit->getWidth() (line 328 of core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php).
Warning: imagesy(): supplied resource is not a valid Image resource in Drupal\system\Plugin\ImageToolkit\GDToolkit->getHeight() (line 343 of core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php).

All other functions of the site are OK.
I can also uplad PDFs with media manager but not images.

thx.

Issue fork drupal-3116611

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

inst created an issue. See original summary.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

xem8vfdh’s picture

I am seeing the same issue, which is preventing my system from generating Image Style instances.

gurunathan’s picture

I face the issue with Drupal 9.0.1 and PHP 7.4.
Any solution?

xem8vfdh’s picture

My issue seems to be specifically tied to php 7.4. I opened this other issue about it, and the errors went away after I downgraded to php 7.3.

gurunathan’s picture

@xeM8VfDh
Strange, it's said that Drupal9 will be supported by PHP 7.4.

xem8vfdh’s picture

yeah, I know, I'm very confused by it as well. I;m on Drupal 8.9.1 by the way.

gurunathan’s picture

Tried to downgrade into 7.3.
It caused the error.
TypeError: Argument 2 passed to Symfony\Component\Routing\RouteCollection::add() must be an instance of Symfony\Component\Routing\Route, bool given, called in /mnt/www/html/midlandsbdev/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php on line 382 in Symfony\Component\Routing\RouteCollection->add() (line 74 of vendor/symfony/routing/RouteCollection.php).

This one fixed that issue.
https://www.drupal.org/project/drupal/issues/3145563#comment-13664364

But the original issue with PHP 7.4 still remains.

xem8vfdh’s picture

That's weird... I had the issue on 7.4 and resolved it by downgrading to 7.3...

cilefen’s picture

Possibly? https://stackoverflow.com/questions/49891991/warning-imagesx-expects-par...

Is GD support for JPEG there on this PHP build?

mondrake’s picture

#10 actually in the requirements we are testing if the gd extension is enabled, but not if specific image formats are supported, and that is a gap IMHO because some PHP builds may miss linking the relevant libs. The only format explicitly checked for is PNG, but the check is in the color (!) module requirements. See also #2340699-111: Let GDToolkit support WEBP image format for similar discussion on supporting WebP image format.

cilefen’s picture

Assigned: inst » Unassigned

Re #11. I was wondering about that. After the OPs check in, let's consider re-framing this issue as a requirements logic improvement if no issue exists.

cilefen’s picture

Also GDToolkit::load doesn't seem to have a good way to signal failure.

xem8vfdh’s picture

So, #10 may actually be my issue as well. I am using pantheon, and their 7.4 does not have JPEG support, but their 7.3 does. Thanks for the suggestion @cilefen!

For those on Pantheon as well, their engineering team is working on resolving this. I'll post back when its done.

I think #11 is a great suggestion.

cilefen’s picture

Title: GD2-toolkit - no thumbnails » Add a requirements testing for library support of image types
Version: 8.9.x-dev » 9.1.x-dev
Category: Support request » Task
Priority: Major » Normal
cilefen’s picture

Title: Add a requirements testing for library support of image types » Add requirements testing for library support of image types
Issue summary: View changes
cilefen’s picture

xem8vfdh’s picture

for what it is worth, Panthon updated their 7.4 environment to include JPEG support for GD. Unfortunately, running this updated environment that used 7.4.3, the issue persists. I can upload and render (create Image Styles) for PNG files no problem, but the JPEG files still present issues:

Unable to generate the derived image located at public://styles/scale_and_crop_thumbnail_square_85x85_/public/research_equipment_pictures/aphex2_0.jpg.

Image scale and crop failed using the gd toolkit on public://research_equipment_pictures/aphex2_0.jpg (image/jpeg, x)

Warning: imagesy(): supplied resource is not a valid Image resource in Drupal\system\Plugin\ImageToolkit\GDToolkit->getHeight() (line 343 of /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php)

#0 /DOCUMENTROOT/code/core/includes/bootstrap.inc(600): _drupal_error_handler_real(2, 'imagesy(): supp...', '/srv/bindings/c...', 343, Array)
#1 [internal function]: _drupal_error_handler(2, 'imagesy(): supp...', '/srv/bindings/c...', 343, Array)
#2 /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php(343): imagesy(Resource id #11)
#3 /DOCUMENTROOT/code/core/lib/Drupal/Core/Image/Image.php(70): Drupal\system\Plugin\ImageToolkit\GDToolkit->getHeight()
#4 /DOCUMENTROOT/code/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php(31): Drupal\Core\Image\Image->getHeight()
#5 /DOCUMENTROOT/code/core/modules/image/src/Entity/ImageStyle.php(324): Drupal\image\Plugin\ImageEffect\ScaleAndCropImageEffect->applyEffect(Object(Drupal\Core\Image\Image))
#6 /DOCUMENTROOT/code/core/modules/image/src/Controller/ImageStyleDownloadController.php(166): Drupal\image\Entity\ImageStyle->createDerivative('public://resear...', 'public://styles...')
#7 [internal function]: Drupal\image\Controller\ImageStyleDownloadController->deliver(Object(Symfony\Component\HttpFoundation\Request), 'public', Object(Drupal\image\Entity\ImageStyle))
#8 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#9 /DOCUMENTROOT/code/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#11 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#12 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#13 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#14 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /DOCUMENTROOT/code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /DOCUMENTROOT/code/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /DOCUMENTROOT/code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#24 {main}

Warning: imagesx(): supplied resource is not a valid Image resource in Drupal\system\Plugin\ImageToolkit\GDToolkit->getWidth() (line 328 of /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php)

#0 /DOCUMENTROOT/code/core/includes/bootstrap.inc(600): _drupal_error_handler_real(2, 'imagesx(): supp...', '/srv/bindings/c...', 328, Array)
#1 [internal function]: _drupal_error_handler(2, 'imagesx(): supp...', '/srv/bindings/c...', 328, Array)
#2 /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php(328): imagesx(Resource id #11)
#3 /DOCUMENTROOT/code/core/lib/Drupal/Core/Image/Image.php(77): Drupal\system\Plugin\ImageToolkit\GDToolkit->getWidth()
#4 /DOCUMENTROOT/code/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php(31): Drupal\Core\Image\Image->getWidth()
#5 /DOCUMENTROOT/code/core/modules/image/src/Entity/ImageStyle.php(324): Drupal\image\Plugin\ImageEffect\ScaleAndCropImageEffect->applyEffect(Object(Drupal\Core\Image\Image))
#6 /DOCUMENTROOT/code/core/modules/image/src/Controller/ImageStyleDownloadController.php(166): Drupal\image\Entity\ImageStyle->createDerivative('public://resear...', 'public://styles...')
#7 [internal function]: Drupal\image\Controller\ImageStyleDownloadController->deliver(Object(Symfony\Component\HttpFoundation\Request), 'public', Object(Drupal\image\Entity\ImageStyle))
#8 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#9 /DOCUMENTROOT/code/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#11 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#12 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#13 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#14 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /DOCUMENTROOT/code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /DOCUMENTROOT/code/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /DOCUMENTROOT/code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#24 {main}

Invalid resource argument

Warning: imagecopyresampled() expects parameter 2 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php)

#0 /DOCUMENTROOT/code/core/includes/bootstrap.inc(600): _drupal_error_handler_real(2, 'imagecopyresamp...', '/srv/bindings/c...', 67, Array)
#1 [internal function]: _drupal_error_handler(2, 'imagecopyresamp...', '/srv/bindings/c...', 67, Array)
#2 /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php(67): imagecopyresampled(Resource id #11, NULL, 0, 0, 0, 0, 150, 85, NULL, NULL)
#3 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php(172): Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute(Array)
#4 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php(124): Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array)
#5 /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/ScaleAndCrop.php(77): Drupal\Core\ImageToolkit\ImageToolkitBase->apply('resize', Array)
#6 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php(172): Drupal\system\Plugin\ImageToolkit\Operation\gd\ScaleAndCrop->execute(Array)
#7 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php(124): Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array)
#8 /DOCUMENTROOT/code/core/lib/Drupal/Core/Image/Image.php(142): Drupal\Core\ImageToolkit\ImageToolkitBase->apply('scale_and_crop', Array)
#9 /DOCUMENTROOT/code/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php(30): Drupal\Core\Image\Image->apply('scale_and_crop', Array)
#10 /DOCUMENTROOT/code/core/modules/image/src/Entity/ImageStyle.php(324): Drupal\image\Plugin\ImageEffect\ScaleAndCropImageEffect->applyEffect(Object(Drupal\Core\Image\Image))
#11 /DOCUMENTROOT/code/core/modules/image/src/Controller/ImageStyleDownloadController.php(166): Drupal\image\Entity\ImageStyle->createDerivative('public://resear...', 'public://styles...')
#12 [internal function]: Drupal\image\Controller\ImageStyleDownloadController->deliver(Object(Symfony\Component\HttpFoundation\Request), 'public', Object(Drupal\image\Entity\ImageStyle))
#13 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#14 /DOCUMENTROOT/code/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#16 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#17 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#19 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /DOCUMENTROOT/code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /DOCUMENTROOT/code/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /DOCUMENTROOT/code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#29 {main}

Warning: imagesy() expects parameter 1 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php)

#0 /DOCUMENTROOT/code/core/includes/bootstrap.inc(600): _drupal_error_handler_real(2, 'imagesy() expec...', '/srv/bindings/c...', 67, Array)
#1 [internal function]: _drupal_error_handler(2, 'imagesy() expec...', '/srv/bindings/c...', 67, Array)
#2 /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php(67): imagesy(NULL)
#3 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php(172): Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute(Array)
#4 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php(124): Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array)
#5 /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/ScaleAndCrop.php(77): Drupal\Core\ImageToolkit\ImageToolkitBase->apply('resize', Array)
#6 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php(172): Drupal\system\Plugin\ImageToolkit\Operation\gd\ScaleAndCrop->execute(Array)
#7 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php(124): Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array)
#8 /DOCUMENTROOT/code/core/lib/Drupal/Core/Image/Image.php(142): Drupal\Core\ImageToolkit\ImageToolkitBase->apply('scale_and_crop', Array)
#9 /DOCUMENTROOT/code/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php(30): Drupal\Core\Image\Image->apply('scale_and_crop', Array)
#10 /DOCUMENTROOT/code/core/modules/image/src/Entity/ImageStyle.php(324): Drupal\image\Plugin\ImageEffect\ScaleAndCropImageEffect->applyEffect(Object(Drupal\Core\Image\Image))
#11 /DOCUMENTROOT/code/core/modules/image/src/Controller/ImageStyleDownloadController.php(166): Drupal\image\Entity\ImageStyle->createDerivative('public://resear...', 'public://styles...')
#12 [internal function]: Drupal\image\Controller\ImageStyleDownloadController->deliver(Object(Symfony\Component\HttpFoundation\Request), 'public', Object(Drupal\image\Entity\ImageStyle))
#13 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#14 /DOCUMENTROOT/code/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#16 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#17 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#19 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /DOCUMENTROOT/code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /DOCUMENTROOT/code/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /DOCUMENTROOT/code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#29 {main}

Warning: imagesx() expects parameter 1 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php)

#0 /DOCUMENTROOT/code/core/includes/bootstrap.inc(600): _drupal_error_handler_real(2, 'imagesx() expec...', '/srv/bindings/c...', 67, Array)
#1 [internal function]: _drupal_error_handler(2, 'imagesx() expec...', '/srv/bindings/c...', 67, Array)
#2 /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php(67): imagesx(NULL)
#3 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php(172): Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute(Array)
#4 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php(124): Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array)
#5 /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/ScaleAndCrop.php(77): Drupal\Core\ImageToolkit\ImageToolkitBase->apply('resize', Array)
#6 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php(172): Drupal\system\Plugin\ImageToolkit\Operation\gd\ScaleAndCrop->execute(Array)
#7 /DOCUMENTROOT/code/core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php(124): Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array)
#8 /DOCUMENTROOT/code/core/lib/Drupal/Core/Image/Image.php(142): Drupal\Core\ImageToolkit\ImageToolkitBase->apply('scale_and_crop', Array)
#9 /DOCUMENTROOT/code/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php(30): Drupal\Core\Image\Image->apply('scale_and_crop', Array)
#10 /DOCUMENTROOT/code/core/modules/image/src/Entity/ImageStyle.php(324): Drupal\image\Plugin\ImageEffect\ScaleAndCropImageEffect->applyEffect(Object(Drupal\Core\Image\Image))
#11 /DOCUMENTROOT/code/core/modules/image/src/Controller/ImageStyleDownloadController.php(166): Drupal\image\Entity\ImageStyle->createDerivative('public://resear...', 'public://styles...')
#12 [internal function]: Drupal\image\Controller\ImageStyleDownloadController->deliver(Object(Symfony\Component\HttpFoundation\Request), 'public', Object(Drupal\image\Entity\ImageStyle))
#13 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#14 /DOCUMENTROOT/code/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#16 /DOCUMENTROOT/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#17 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /DOCUMENTROOT/code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#19 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /DOCUMENTROOT/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /DOCUMENTROOT/code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /DOCUMENTROOT/code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /DOCUMENTROOT/code/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /DOCUMENTROOT/code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#29 {main}
xem8vfdh’s picture

this is a critical issue that prevents using Drupal on 7.4. As 7.3 will hit its end of life relatively soon, I'm wondering if this issue merits having it's priority increased.

cilefen’s picture

Title: Add requirements testing for library support of image types » Cannot create image derivatives if GD image type support is missing
Category: Task » Bug report
Priority: Normal » Major

Did Pantheon in the end add support for JPEG in GD? Drupal could test for library support in the related issues (as I've titled this one, it is probably a duplicate—so I retitled it to be more like a bug). But I don't know how Drupal could work around a missing GD library. Any ideas?

xem8vfdh’s picture

Sorry @cilefen, I typed a reply to you days ago and must have never submitted it.

yes you can review the Pantheon 7.4 env here, and it does now support JPEG with GD. However, despite upgrading my Pantheon 8.9.2 site from 7.3 to 7.4, I am still seeing the errors in #18.

I had to downgrade back to 7.3 to prevent error.

cilefen’s picture

I think GDToolkit::load returns false and never sets the resource property. Is imagecreatefromjpeg, from GD, a global function on that new PHP build?

Could you use ImageMagick temporarily?

xem8vfdh’s picture

Hey @clefen, unfortunately I have no control over Pantheon, so I can't easily test those packages. But, since 7.3 works and 7.4 doesn't, can you spot any difference in those separate phpinfo outputs that might indicate the issue here?

cilefen’s picture

They were configured for compilation differently. In 7.3 the flag is --with-jpeg-dir=/usr but in 7.4 it is --with-jpeg. But I assume that is for a reason. Ask support if function imagecreatefromjpeg exists in their PHP 7.4 container.

xem8vfdh’s picture

Awesome, I will look into it @cilefen and get back to you, I really appreciate it!

xem8vfdh’s picture

@cilefen, I just received this from Pantheon:

We do have the imagecreatefromjpeg function available - I confirmed on my test site - https://epz.io/script.php - Though there is an error displayed, you'll see it's not related to the function itself not being available, but rather an issue with the input I've provided it. I just placed this script in my /web folder:

echo "hello world";
$resource = imagecreatefromjpeg('sites/default/files/2020-04/drupal.jpg');
print_r($resource, TRUE);
echo "Current PHP Version: " . phpversion();
cilefen’s picture

🤷‍♀️

The stack trace you posted in the issue summary indicates two things. First, that imagesy was passed a resource but it "is not a valid Image resource":

#2 /DOCUMENTROOT/code/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php(343): imagesy(Resource id #11)

But then, this runtime warning suggests that ::load did not return anything:

Warning: imagesx() expects parameter 1 to be resource, null given in Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute() (line 67 of core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php).

Ostensibly someone could build a minimal reproduction on a clean Drupal install on Pantheon and hand that off to support.

xem8vfdh’s picture

@cilefen, so are you confident that this issue is likely the result of the Pantheon environment, as opposed to drupal/GD/7.4/etc? if so I will reproduce there and ask them to investigate. Thanks again for the helpful insight.

cilefen’s picture

It is not reproducible with Homebrew PHP 7.4 by uploading a jpg and creating jpg variants. Incidentally, Homebrew's compiled-in GD jpeg support is:

JPEG Support enabled
libJPEG Version 9 compatible

xem8vfdh’s picture

hey @cilefen, I worked with Pantheon to try to reproduce in their 7,4 environment. I wasn't able to, so maybe I just didn't test properly after they fixed their 7.4 environment. I can't say, but hopefully I just screwed something up and this is no longer an issue with pantheon 7.4 or my system. If the issue resurfaces, I will post here. Thanks very much for the help, I really appreciate it.

cilefen’s picture

Category: Bug report » Support request
Priority: Major » Normal

Thanks for the follow-up. I am moving this back to a support request because the title now sounds like a statement of fact ;-).

jedgar1mx’s picture

This is not a Pantheon only issue, Acquia also has issues with PHP 7.4. I had to downgrade to PHP 7.3 to temporarily fix the issue. Seems to be an environment issue.

cilefen’s picture

@jedgar1mx Did you report it to them, and reference this issue?

jedgar1mx’s picture

I reported it to acquia awhile back and it seems they will be doing some updates to their platform. I just found this issue while looking for some other stuff. Figured I should let acquia users know 🙂.

mforbes’s picture

Acquia lists it as a known issue at https://docs.acquia.com/cloud-platform/known-issues/#some-image-formats-... and support clarified the cause to be PHP 7.4 doesn't have jpg and png support compiled into the GD library. We are on D7 and experienced it.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

mrjey’s picture

If you are using docker, you can build your GD library with JPEG using the following lines:

RUN apt-get update \
    && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev
RUN docker-php-ext-configure gd --with-jpeg --with-freetype \
    && docker-php-ext-install gd

This way GD is compiled and enabled with libjpeg and the problem is solved.

mforbes’s picture

The fix has been deployed on Acquia.

mondrake’s picture

Status: Active » Needs review
StatusFileSize
new3.72 KB

This patch add requirements check for the existence of the image functions for the format supported by the GD toolkit.

mondrake’s picture

StatusFileSize
new5.89 KB
new2.69 KB
anil.gangwal’s picture

I am able to solve this issue by adding below configuration to docker file.
This works with PHP 7.4 and Drupal 9 for GD issue

apt-get update; \
apt-get install -y --no-install-recommends \
build-essential \
libfreetype6-dev \
libjpeg-dev \
libpng-dev \
libpq-dev \
libzip-dev \
libjpeg62-turbo-dev \
# GD
docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install -j "$(nproc)" \
gd \
; \

cilefen’s picture

Title: Cannot create image derivatives if GD image type support is missing » Add a requirements check for GD support of allowed image types
Category: Support request » Task
mondrake’s picture

Status: Needs review » Needs work

Getting this in the db log:

Notice: Undefined index: severity in color_requirements() (line 38 of /var/www/d91/core/modules/color/color.install)
#0 /var/www/d91/core/includes/bootstrap.inc(305): _drupal_error_handler_real(8, 'Undefined index...', '/var/www/d91/co...', 38)
#1 /var/www/d91/core/modules/color/color.install(38): _drupal_error_handler(8, 'Undefined index...', '/var/www/d91/co...', 38, Array)
#2 [internal function]: color_requirements('runtime')
#3 /var/www/d91/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('color_requireme...', Array)
mondrake’s picture

Status: Needs work » Needs review

Never mind #43... I was running an old patch. Sorry for the noise.

mondrake’s picture

Rerolled and cleaned up after commit of #2340699: Let GDToolkit support WEBP image format. Changed to MR workflow.

andypost’s picture

Status: Needs review » Needs work

Added 2 comments and it looks mostly great!

mondrake’s picture

Status: Needs work » Needs review

Thanks for review @andypost, fixed your points.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

nikral’s picture

Version: 9.4.x-dev » 9.3.x-dev

I have the same issue on PHP 8.0 and Drupal 9.3.12

TypeError : imagesx(): Argument #1 ($image) must be of type GdImage, null given dans imagesx() (/web/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php ligne 67)
#0 /web/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php(67): imagesx(NULL)
#1 /web/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php(86): Drupal\system\Plugin\ImageToolkit\Operation\gd\Resize->execute(Array)
#2 /web/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php(172): Drupal\system\Plugin\ImageToolkit\Operation\gd\Scale->execute(Array)
#3 /web/core/lib/Drupal/Core/ImageToolkit/ImageToolkitBase.php(124): Drupal\Core\ImageToolkit\ImageToolkitOperationBase->apply(Array)
#4 /web/core/lib/Drupal/Core/Image/Image.php(142): Drupal\Core\ImageToolkit\ImageToolkitBase->apply('scale', Array)
#5 /web/core/lib/Drupal/Core/Image/Image.php(198): Drupal\Core\Image\Image->apply('scale', Array)
#6 /web/core/modules/image/src/Plugin/ImageEffect/ScaleImageEffect.php(24): Drupal\Core\Image\Image->scale(220, 220, false)
#7 /web/core/modules/image/src/Entity/ImageStyle.php(329): Drupal\image\Plugin\ImageEffect\ScaleImageEffect->applyEffect(Object(Drupal\Core\Image\Image))
#8 /web/core/modules/image/src/Controller/ImageStyleDownloadController.php(184): Drupal\image\Entity\ImageStyle->createDerivative('public://2022-0...', 'public://styles...')
#9 [internal function]: Drupal\image\Controller\ImageStyleDownloadController->deliver(Object(Symfony\Component\HttpFoundation\Request), 'public', Object(Drupal\image\Entity\ImageStyle))
#10 /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#11 /web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#13 /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#14 /vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#16 /web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#25 {main}

Fixed by

RUN apt-get update \
    && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev
RUN docker-php-ext-configure gd --with-jpeg --with-freetype \
    && docker-php-ext-install gd
avpaderno’s picture

Version: 9.3.x-dev » 9.4.x-dev
mondrake’s picture

Bumped the MR target branch and rebased.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mondrake’s picture

Thanks @heddn, merged your suggestions

mondrake’s picture

Version: 9.5.x-dev » 10.1.x-dev
mondrake’s picture

Rebased for 10.1.x, and at this stage dropped the changes to the color module that it's better be left alone since it is up for removal in D10.

mondrake’s picture

Assigned: Unassigned » mondrake
Status: Needs review » Needs work

Working on adding a kernel test.

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Needs work » Needs review
andypost’s picture

Status: Needs review » Needs work
Issue tags: +Usability, +Needs usability review, +Needs screenshots

Needs CS fix but overall looks great!

Tagging for usability review as if GD library missing more then one format it could look weird

Would be great to add screenshots about how it may look

PS: thinking about contrib module /project/imagemagick which using convert CLI command - how it may change the message for supported formats

mondrake’s picture

Issue tags: -Needs screenshots
StatusFileSize
new11.78 KB
new14.43 KB
new21.12 KB

Screenshots taken from the status report page:

ALL GOOD

One format missing

Two formats missing

mondrake’s picture

Status: Needs work » Needs review
andypost’s picture

Thank you! That's what I mean when more then one format is missing

I find it more readable if it will be one-liner - The GD library was compiled without following formats: JPEG, WEBP. Check the...

andypost’s picture

Added commit to fix #63

mondrake’s picture

Thanks, did some more cleanup, we would need new screenshots now.

mondrake’s picture

Assigned: Unassigned » mondrake
Status: Needs review » Needs work
mondrake’s picture

New screeshots:

One format missing

Two formats missing

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Needs work » Needs review
andypost’s picture

Status: Needs review » Needs work

IMO it's ready to go but still needs UX POV on it and wording

andypost’s picture

Status: Needs work » Needs review
benjifisher’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

When you tag an issue for usability review, please make it easy for the usability team to review the issue. Update the issue summary:

  • The "Proposed resolution" section should describe all the changes made in the issue.
  • The "User interface changes" should show the existing UI and the proposed UI.

Most of the time, I prefer to have plain text in the "Proposed resolution" section and screenshots in the "User interface changes" section.

You can also attend the weekly usability meeting to present an issue.

I am adding the tag for an issue summary update and setting the status to NW.

mondrake’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update
StatusFileSize
new20.53 KB

Honestly I think usability review here is a bit of an overkill, but updated IS according to #71 anyway.

Thanks.

mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
rkoller’s picture

Status: Needs review » Needs work
Issue tags: -Needs usability review

We've discussed the issue at #3296084: Drupal Usability Meeting 2022-07-15. That issue will have a link to a recording of the meeting. For the record the attendees at todays (07-15-2022) usability meeting were @benjifisher, @shaal, @simohell, @worldlinemine, and me.

There was a consensus that it is useful feature. We would have two suggestions in regards of the scan-ability of the micro copy. Currently it reads for one file format missing:

Supported image file formats: JPEG, PNG, WEBP. 
The GD library was compiled without the support for the GIF image format. Check the PHP GD Installation documentation for information on how to correct this. 

for two image formats missing:

Supported image file formats: PNG, WEBP. 
The GD library was compiled without the support for the following image formats: GIF, JPEG. Check the PHP GD Installation documentation for information on how to correct this. 

The information of interest are the supported image file formats. That is easily scan-able. You have the keyword Supported and then there is the visual queue of the italic file format list. That's good.
If the user wants to know the unsupported file formats he or she first has to scan the bits about GD library, compilation and so forth until the points of interest, the unsupported file format(s) could finally be found.
The other detail is the end of the second sentence about how to correct which implies that something is wrong. But perhaps the selection of file formats was a conscious decision. We would suggest the following pattern:

one file format missing

Supported image file formats: JPEG, PNG, WEBP. 
Unsupported image file format: GIF. 
Check the PHP GD Installation documentation if you want to add support for this format.

two image formats missing:

Supported image file formats: PNG, WEBP. 
Unsupported image file formats: GIF, JPEG. 
Check the PHP GD Installation documentation if you want to add support for these formats.

That way you have the identical easy to scan pattern for the supported as well as unsupported image file formats. The description about the unsupported file formats gets shorter and more concise - you provide the link to the documentation for those interested and or necessity how to add support.

I'll set the issue to needs work and remove the needs usability review tag.

mondrake’s picture

Status: Needs work » Needs review

Thanks a lot team for the review.

I made changes to the MR according to the feedback.

mondrake’s picture

Updated IS with latest screenshots.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

I find it ready to go

mondrake’s picture

Rebased

mondrake’s picture

rebased

mondrake’s picture

rebased

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Added a review to gitlab

mondrake’s picture

Status: Needs work » Needs review

Made the suggested fixes.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Suggestions addressed, let's get it in

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I think we can have less reliance on array keys and more rely on PHP constants. See code review above & in gitlab

mondrake’s picture

Status: Needs work » Needs review

Made fixes according to @alexpott's input. Thanks!

andypost’s picture

It looks rtbc but I'm curious about to define array of formats as enum, so when we'll add avif format it will need to change less places

mondrake’s picture

OK, but I wouldn't hold on that... otherwise this becomes a never ending issue...

daffie’s picture

Status: Needs review » Reviewed & tested by the community

All the code changes look good to me.
All the points of @alexpott have been adressed.
The IS is in order.
For me it is RTBC.

alexpott’s picture

Version: 10.1.x-dev » 10.0.x-dev
Status: Reviewed & tested by the community » Fixed

Backported this to 10.0.x because it is a task that is a pure addition and useful. Didn't backport to 9.5.x because it has a PHP 7.4 feature...

Committed and pushed 00d6bd97a7 to 10.1.x and ee88d7a711 to 10.0.x. Thanks!

  • alexpott committed 00d6bd9 on 10.1.x
    Issue #3116611 by mondrake, andypost, cilefen, xeM8VfDh, alexpott,...

  • alexpott committed ee88d7a on 10.0.x
    Issue #3116611 by mondrake, andypost, cilefen, xeM8VfDh, alexpott,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

liam morland’s picture

There is a proposal to change this check in #3570466: Reduce severity of GD library supported image file formats warning. Please review and comment.