protected function addImageServicesToContainer(Container $container, $rootDir = null)
{
$imagine = new ImagineGd();
$imagineSvg = new ImagineSvg();
$calculator = new ResizeCalculator();
$filesystem = new Filesystem();
$framework = $this->mockContaoFramework();
$resizer = new LegacyResizer(($rootDir ?: $this->getRootDir()) . '/' . $container->getParameter('contao.image.target_path'), $calculator);
$resizer->setFramework($framework);
$imageFactory = new ImageFactory($resizer, $imagine, $imagineSvg, $filesystem, $framework, $container->getParameter('contao.image.bypass_cache'), $container->getParameter('contao.image.imagine_options'), $container->getParameter('contao.image.valid_extensions'));
$pictureGenerator = new PictureGenerator($resizer, $container->getParameter('contao.image.bypass_cache'), $rootDir ?: $this->getRootDir());
$pictureFactory = new PictureFactory($pictureGenerator, $imageFactory, $framework, $container->getParameter('contao.image.bypass_cache'), $container->getParameter('contao.image.imagine_options'));
$container->set('filesystem', $filesystem);
$container->set('contao.image.imagine', $imagine);
$container->set('contao.image.imagine_svg', $imagineSvg);
$container->set('contao.image.resize_calculator', $calculator);
$container->set('contao.image.resizer', $resizer);
$container->set('contao.image.image_factory', $imageFactory);
$container->set('contao.image.picture_generator', $pictureGenerator);
$container->set('contao.image.picture_factory', $pictureFactory);
}