Refactor: Remove some duplication found by phpcpd. One more to go.
Resize test images