Check that php-gd or php-imagick is available, before calling `wp media regenerate`

Came out of #591.

I think there might be a Wordpress function that does this.