Refactored the sfImageService.query() function