Page MenuHomePhorge

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

Authored by aklapper on Wed, Jan 24, 10:15.
Tags
None
Referenced Files
F1393965: D25525.id1693.diff
Wed, Feb 21, 04:36
F1392418: D25525.id1701.diff
Tue, Feb 20, 16:43
Unknown Object (File)
Tue, Feb 20, 03:24
Unknown Object (File)
Mon, Feb 19, 17:38
Unknown Object (File)
Wed, Feb 14, 03:12
Unknown Object (File)
Sat, Feb 10, 15:57
Unknown Object (File)
Tue, Feb 6, 03:38
Unknown Object (File)
Tue, Jan 30, 14:47

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.Mon, Feb 12, 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!