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