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
F2943467: D25525.1738193752.diff
Tue, Jan 28, 23:35
F2938360: D25525.1737994316.diff
Sun, Jan 26, 16:11
F2938359: D25525.1737994313.diff
Sun, Jan 26, 16:11
F2938358: D25525.1737994310.diff
Sun, Jan 26, 16:11
F2938357: D25525.1737994307.diff
Sun, Jan 26, 16:11
F2936267: D25525.1737911666.diff
Sat, Jan 25, 17:14
F2932658: D25525.1737741267.diff
Thu, Jan 23, 17:54
F2932657: D25525.1737741264.diff
Thu, Jan 23, 17:54

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
Branch
noImgFormatsNoCry (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1057
Build 1057: arc lint + arc unit

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!