I need to generate some JSON content in controller and I need to get the full URL to an uploaded image situated here : /web/uploads/myimage.jpg.
/web/uploads/myimage.jpg
How can
You can use this in Controller:
$this->getRequest()->getUriForPath('/uploads/myimage.jpg');
EDIT : This method also includes the app.php and app_dev.php to the url. Meaning this will only work in production when url-rewriting is enabled!
app.php
app_dev.php