Page MenuHomePhorge

Improve messages when no image formats are supported (due to GD not installed)
ClosedPublic

Authored by aklapper on Jan 24 2024, 10:15.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 22:39
Unknown Object (File)
Wed, Apr 17, 18:21
Unknown Object (File)
Wed, Apr 17, 06:55
Unknown Object (File)
Thu, Apr 4, 01:41
Unknown Object (File)
Thu, Apr 4, 01:34
Unknown Object (File)
Sun, Mar 31, 05:21
Unknown Object (File)
Sun, Mar 31, 05:16
Unknown Object (File)
Sat, Mar 30, 13:22

Details

Summary

When GD is not installed, trying to set a custom image for a project/blog/repository/user/etc displays unhelpful error messages (This server only supports these image formats: . and Supported formats: ) due to the array of supported image formats being empty.

Display clearer messages instead.

Closes T15720

Test Plan

Do not have php-gd installed, go to /project/manage/1/, take a look at the string below the "Upload Picture" button, select Edit Picture in the sidebar, select Custom: Choose Icon and Color..., Choose Background Color and Choose Icon, then click the Save Image button. Also try to upload a custom image and look at the error message.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I super-like the result of this in /project/manage/1/, so approved.

Bonus points:

Maybe simplify if (empty($v)) { to just if ($v) { and swapping the case

https://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting

This revision is now accepted and ready to land.Feb 12 2024, 10:38

Maybe simplify if (empty($v)) { to just if ($v) { and swapping the case

Ahem, such comments always make me realize how my brain structure isn't necessarily a simplicity role model. :P
Yes, doing so in the next revision. Thanks!