Image resize middleware for Slim framework