diff --git a/Templating/ImageLocator.php b/Templating/ImageLocator.php index 9273ed1..45528fc 100644 --- a/Templating/ImageLocator.php +++ b/Templating/ImageLocator.php @@ -34,12 +34,14 @@ public function __construct(Kernel $kernel) public function getImagePath($logicalImageName) { $pos = strpos($logicalImageName, ':'); + + $exists = is_dir($this->kernel->getRootDir() . '/Resources/public/images/'); // add support for ::$imagePath syntax as in twig // @see http://symfony.com/doc/current/book/page_creation.html#optional-step-3-create-the-template if($pos === false || $pos === 0) { - return $this->kernel->getRootDir() . '/Resources/public/images/' . ltrim($logicalImageName, ':'); + return $this->kernel->getRootDir() . '/Resources/public/'.(!$exists ? 'img/' : 'images/') . ltrim($logicalImageName, ':'); } $bundleName = substr($logicalImageName, 0, $pos); @@ -48,6 +50,7 @@ public function getImagePath($logicalImageName) $bundle = $this->kernel->getBundle($bundleName); $bundlePath = $bundle->getPath(); - return $bundlePath.'/Resources/public/images/'.$imageName; + return $bundlePath.'/Resources/public/'.(!$exists ? 'img/' : 'images/') .$imageName; + } }