'Add Watermark' image effect cause "Invalid resource argument" error

Created on 21 September 2022, about 2 years ago
Updated 27 May 2024, 6 months ago

Problem/Motivation

'Add Watermark' image effect cause "Invalid resource argument" error.
More detailed:

  1. \Drupal\basic_watermark\Plugin\ImageToolkit\Operation\gd\AddWatermark::execute()
    

    calles

    $this->getToolkit()->setResource(TRUE);
    
  2. \Drupal\system\Plugin\ImageToolkit\GDToolkit::setResource()
    

    throws error

    throw new \InvalidArgumentException('Invalid resource argument');
    

    \Drupal\system\Plugin\ImageToolkit\GDToolkit::setResource() doesn't support boolean input parameter

  3. \Drupal\Core\ImageToolkit\ImageToolkitBase::apply()
    

    catches error and log it with

    $this->logger->warning($e->getMessage(), []);
    

Steps to reproduce

1. Create any image style with 'Add Watermark' effect.
2. Upload and display any image with created image-style.
3. Visit /admin/reports/dblog and see "Invalid resource argument" error

Proposed resolution

Remove

$this->getToolkit()->setResource(TRUE);
imagedestroy($image_resource);

from \Drupal\basic_watermark\Plugin\ImageToolkit\Operation\gd\AddWatermark::execute()

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine deimos

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024