Problem
When adding an image to a topic page, you don't get any feedback when the dimensions of the image is too large. The result is no image shown at all. Next to the button 'choose file' you see the name of the file, but no image.

What you expect is feedback, like a red line and/or text showing the max possible size of the image

Solution
Provide inline feedback when uploaded image is too big

Comments

xinyuma created an issue. See original summary.

kingdutch’s picture

Version: 8.x-9.x-dev » 10.2.x-dev

There's a long running Drupal core issue about this in #2583041: GD toolkit & operations should catch \Throwable to fail gracefully in case of errors. A possible user-land workaround in the meantime seems to be provided in #2977956: Recover from php/gd memory_limit exhausted (the ticket is for Drupal 7 but most of it should carry over).

kingdutch’s picture

Issue summary: View changes

Updated issue summary to clarify that this is about pixel size, not actual file size. The file size is already handled by other upload limits (and feedback should already be present). The error that's caused due to the pixel count results in the described behaviour of not having an error message (since the result terminates early).

The threshold (which is also seen in the linked Drupal 7 issue) is when width * height * channels > PHP_MAX_MEMORY. Channels for most images is 3 (Red, Green and Blue) some formats may have 4 (Red, Green, Blue, Alpha).