Refactoring ImageProcessingListener.php