Skip to content

Commit

Permalink
Merge pull request #20 from jmsche/master
Browse files Browse the repository at this point in the history
DefaultController uses Request from ParamConverter instead of $this->…
  • Loading branch information
Jérôme Poskin committed Jun 4, 2015
2 parents c73df60 + 7bd1ea6 commit 5f8ae5f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

namespace Snowcap\ImBundle\Controller;

use Snowcap\ImBundle\Exception\RuntimeException;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

use Snowcap\ImBundle\Exception\RuntimeException;

/**
* Controls calls to resized images
*/
Expand All @@ -24,13 +24,13 @@ class DefaultController extends Controller
/**
* Main action: renders the image cache and returns it to the browser
*
* @param Request $request
* @param string $format A format name defined in config or a string [width]x[height]
* @param string $path The path of the source file (@see Manager::downloadExternalImage for more info on external/remote images)
* @param string $path The path of the source file (@see Manager::downloadExternalImage for more info on external/remote images)
*
* @return \Symfony\Component\HttpFoundation\Response
* @throws \Snowcap\ImBundle\Exception\RuntimeException
* @return Response
*/
public function indexAction($format, $path)
public function indexAction(Request $request, $format, $path)
{
/** @var $im \Snowcap\ImBundle\Manager */
$im = $this->get("snowcap_im.manager");
Expand All @@ -46,7 +46,7 @@ public function indexAction($format, $path)
throw new RuntimeException(sprintf("Caching of image failed for %s in %s format", $path, $format));
} else {
$extension = pathinfo($path, PATHINFO_EXTENSION);
$contentType = $this->getRequest()->getMimeType($extension);
$contentType = $request->getMimeType($extension);
if (empty($contentType)) {
$contentType = 'image/' . $extension;
}
Expand Down

0 comments on commit 5f8ae5f

Please sign in to comment.