Skip to content

Instantly share code, notes, and snippets.

@OneWeb
Created August 14, 2014 14:20
Show Gist options
  • Save OneWeb/280cfa9613b20202f74b to your computer and use it in GitHub Desktop.
Save OneWeb/280cfa9613b20202f74b to your computer and use it in GitHub Desktop.
Get Sonata Media Url in Controller
<?php
$webdir = $this->get('kernel')->getRootDir() . '/../web' . $this->getRequest()->getBasePath();
$fullimgpath = $webdir . $this->container->get('sonata.media.twig.extension')->path($report->getImage(), 'reference');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment