File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,6 +226,7 @@ private function hasCombinedManipulationParams()
226226 private function getMetaParams ($ item )
227227 {
228228 $ params = collect ();
229+ $ manipulation_params = $ this ->getManipulationParams ($ item );
229230
230231 // Set focus related parameters.
231232 if ($ item ->get ('focus ' )) {
@@ -235,6 +236,20 @@ private function getMetaParams($item)
235236 $ y = floor (($ y_percentage / 100 ) * $ this ->getOriginalHeight ($ item ));
236237 $ zoom = floor ($ zoom * 10 ) / 10 ;
237238
239+ $ params ->put ('x ' , $ x );
240+ $ params ->put ('y ' , $ y );
241+ $ params ->put ('zoom ' , $ zoom );
242+ $ params ->put ('gravity ' , 'xy_center ' );
243+ } else if ($ manipulation_params ->has ('crop ' ) && $ manipulation_params ->get ('crop ' ) === 'fill ' ) {
244+ /**
245+ * When using `fit="crop_focal"` in statamic and NOT defining a focal point, the asset is cropped by glide from the center point.
246+ * In contrary, when using cloudinary, this is not the case.
247+ * The following code replicates this behavior.
248+ */
249+ $ x = floor (0.5 * $ this ->getOriginalWidth ($ item ));
250+ $ y = floor (0.5 * $ this ->getOriginalHeight ($ item ));
251+ $ zoom = 1 ;
252+
238253 $ params ->put ('x ' , $ x );
239254 $ params ->put ('y ' , $ y );
240255 $ params ->put ('zoom ' , $ zoom );
You can’t perform that action at this time.
0 commit comments