Don't sample every pixel of large logos

The analyze_img code examined every pixel of the image; for large
images, this caused the page to time out, thus making it impossible to
change the image away from the problematically-large one.

Subsample the image if it is more than 200px on a side, by sampling in
an even 200x200 grid.  200px was chosen as an arbitrary upper limit; 40k
points is still a large number to sample, but in testing can be done in
less than 10s.

Fixes #29929.
gd_can need not be a global
Do not install a subroutine into the HTML::Mason::Commands namespace

sub {} in a Mason component makes the sub accessible to every Mason
component, and is highly discouraged.  Use a local subref instead.
Replace a needless hashref with a plain hash
Move List::MoreUtils closer to where it is used
Remove an unnecessary warning triggered by single-colored logos
Move GD checking into $analyze_img
Move $analyze_img earlier
Cache the found colors in the logo attribute

As determining these colors may be time-intensive, and is guaranteed to
not change while the logo itself does not change, the information should
simply be stored alongside the logo.
Merge branch '4.2/subsample-logo' into 4.2-trunk