File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -318,13 +318,17 @@ function image_graphicsmagick_toolkit_get_info(object $image): false|array {
318
318
$details['width'] = $handler->imageWidth();
319
319
$details['height'] = $handler->imageHeight();
320
320
}
321
- catch (GmagickException ) {
321
+ catch (InvalidArgumentException | Error $e ) {
322
322
// An exception has been thrown when trying to access the image information,
323
323
// which could also mean the image file is corrupted. Return FALSE to signal
324
324
// an error.
325
+ watchdog_exception('graphicsmagick', $e);
326
+
325
327
return FALSE;
326
328
}
327
329
330
+ $image->handler = NULL;
331
+
328
332
return $details;
329
333
}
330
334
Original file line number Diff line number Diff line change @@ -75,6 +75,19 @@ class ImageHandler {
75
75
return file_unmanaged_copy ($ source , $ destination , FILE_EXISTS_REPLACE );
76
76
}
77
77
78
+ /**
79
+ * Creates the image handler.
80
+ *
81
+ * @param object $image
82
+ * An image object. The $image->handler value will be set by this call.
83
+ *
84
+ * @return $this|null
85
+ * The image handler or NULL if the image could not be loaded.
86
+ *
87
+ * @throws InvalidArgumentException
88
+ * $image->handler is not NULL nor an instance of the current class.
89
+ * $image->source is not a string.
90
+ */
78
91
public static function create (object $ image ): ?self {
79
92
if (isset ($ image ->handler ) && !is_a ($ image ->handler , self ::class)) {
80
93
throw new InvalidArgumentException ('The image handler must be an instance of ' . self ::class . '. ' );
You can’t perform that action at this time.
0 commit comments