public function imageAction(Request $request)
    {
        $params = $request->request->all();

        unset($params['module']);
        unset($params['controller']);
        unset($params['action']);

        if (empty($params['width'])) {
            $params['width'] = 100;
        }
        if (empty($params['height'])) {
            $params['height'] = 100;
        }
        if (empty($params['xmethod'])) {
            $params['xmethod'] = 'fit';
        }

        $previewer = $this->get('phlexible_media_template.previewer.image');
        $locator = $this->get('file_locator');

        $previewImage = 'test_1000_600.jpg';
        if (isset($params['preview_image'])) {
            $previewImage = $params['preview_image'];
            unset($params['preview_image']);
            if ($previewImage === '800_600') {
                $previewImage = "test_$previewImage.png";
            } else {
                $previewImage = "test_$previewImage.jpg";
            }
        }

        $filePath = $locator->locate("@PhlexibleMediaTemplateBundle/Resources/public/images/$previewImage", null, true);
        $data = $previewer->create($filePath, $params);

        return new ResultResponse(true, 'Preview created', $data);
    }