@@ 102-124 (lines=23) @@ | ||
99 | * @param null $routeName |
|
100 | * @return string |
|
101 | */ |
|
102 | public function mediaImage( |
|
103 | \Twig_Environment $environment, |
|
104 | MediaInterface $media, |
|
105 | $width, |
|
106 | $height, |
|
107 | array $parameters = [], |
|
108 | $routeName = null |
|
109 | ) { |
|
110 | $parameters += [ |
|
111 | 'w' => $width, |
|
112 | 'h' => $height, |
|
113 | ]; |
|
114 | ||
115 | return $environment->render( |
|
116 | 'MediaMonksSonataMediaBundle:Image:image.html.twig', |
|
117 | [ |
|
118 | 'src' => $this->urlGenerator->generate($media, $parameters, $routeName), |
|
119 | 'width' => $width, |
|
120 | 'height' => $height, |
|
121 | 'title' => $media->getTitle(), |
|
122 | ] |
|
123 | ); |
|
124 | } |
|
125 | ||
126 | /** |
|
127 | * @param \Twig_Environment $environment |
|
@@ 135-157 (lines=23) @@ | ||
132 | * @param null $routeName |
|
133 | * @return string |
|
134 | */ |
|
135 | public function mediaDownload( |
|
136 | \Twig_Environment $environment, |
|
137 | MediaInterface $media, |
|
138 | $width, |
|
139 | $height, |
|
140 | array $parameters = [], |
|
141 | $routeName = null |
|
142 | ) { |
|
143 | $parameters += [ |
|
144 | 'w' => $width, |
|
145 | 'h' => $height, |
|
146 | ]; |
|
147 | ||
148 | return $environment->render( |
|
149 | 'MediaMonksSonataMediaBundle:Image:file.html.twig', |
|
150 | [ |
|
151 | 'src' => $this->urlGenerator->generate($media, $parameters, $routeName), |
|
152 | 'width' => $width, |
|
153 | 'height' => $height, |
|
154 | 'title' => $media->getTitle(), |
|
155 | ] |
|
156 | ); |
|
157 | } |
|
158 | ||
159 | /** |
|
160 | * @param MediaInterface $media |