| @@ 39-49 (lines=11) @@ | ||
| 36 | * @param $id |
|
| 37 | * @return StreamedResponse |
|
| 38 | */ |
|
| 39 | public function downloadAction(Request $request, $id) |
|
| 40 | { |
|
| 41 | $object = $this->admin->getObject($id); |
|
| 42 | ||
| 43 | $this->admin->checkAccess('show', $object); |
|
| 44 | ||
| 45 | return $this->get('mediamonks.sonata_media.utility.download')->getStreamedResponse( |
|
| 46 | $object, |
|
| 47 | new DownloadParameterBag($request->query->all()) |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * @param Request $request |
|
| @@ 56-66 (lines=11) @@ | ||
| 53 | * @param int $id |
|
| 54 | * @return RedirectResponse |
|
| 55 | */ |
|
| 56 | public function imageAction(Request $request, $id, $width, $height) |
|
| 57 | { |
|
| 58 | $object = $this->admin->getObject($id); |
|
| 59 | ||
| 60 | $this->admin->checkAccess('show', $object); |
|
| 61 | ||
| 62 | return $this->get('mediamonks.sonata_media.utility.image')->getRedirectResponse( |
|
| 63 | $object, |
|
| 64 | new ImageParameterBag($width, $height, $request->query->all()) |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||