Add image generation code adapted for symfony