@@ -18,7 +18,7 @@ class ThumbnailController extends Controller
1818 protected $ server ;
1919
2020 /**
21- * @var Generator
21+ * @var ImageGenerator
2222 */
2323 protected $ generator ;
2424
@@ -32,6 +32,11 @@ class ThumbnailController extends Controller
3232 */
3333 protected $ size ;
3434
35+ /**
36+ * @var string
37+ */
38+ protected $ orientation ;
39+
3540 /**
3641 * @var string
3742 */
@@ -52,11 +57,13 @@ public function __construct(Server $server, ImageGenerator $generator)
5257 *
5358 * @param string $asset
5459 * @param string $size
60+ * @param string $orientation
5561 * @return \Illuminate\Http\Response
5662 */
57- public function show ($ asset , $ size = null )
63+ public function show ($ asset , $ size = null , $ orientation = null )
5864 {
5965 $ this ->size = $ size ;
66+ $ this ->orientation = $ orientation ;
6067 $ this ->asset = $ this ->asset ($ asset );
6168
6269 if ($ placeholder = $ this ->getPlaceholderResponse ()) {
@@ -107,9 +114,28 @@ private function generate()
107114 return $ path ;
108115 }
109116
110- public function getPreset ()
117+ /**
118+ * Get control panel thumbnail image preset name.
119+ *
120+ * Statamic has few control panel specific image presets
121+ *
122+ * @see \Statamic\Imaging\Manager::cpManipulationPresets
123+ *
124+ * @return string
125+ */
126+ private function getPreset ()
127+ {
128+ return "cp_thumbnail_ {$ this ->size }_ {$ this ->getOrientation ()}" ;
129+ }
130+
131+ /**
132+ * Get orientation override from URL path or directly from asset.
133+ *
134+ * @return string|null
135+ */
136+ private function getOrientation ()
111137 {
112- return " cp_thumbnail_ { $ this ->size } _ { $ this ->asset ->orientation ()}" ;
138+ return $ this ->orientation ?? $ this ->asset ->orientation ();
113139 }
114140
115141 /**
0 commit comments