@@ -201,7 +201,7 @@ public static function cropAndScale($imagePath, $variation, $newHeight, $newWidt
201
201
$ height = $ image ->getImageHeight ();
202
202
$ actions = self ::computeCropAndScale ($ width , $ height , $ newWidth , $ newHeight , $ options );
203
203
if ($ actions ->scale != 1 ) {
204
- $ image ->scaleImage ($ actions ->factor * $ width , 0 );
204
+ $ image ->scaleImage ($ actions ->factor * $ width , $ actions -> factor * $ height );
205
205
}
206
206
if ($ image ->cropImage ($ actions ->width , $ actions ->height , $ actions ->x , $ actions ->y )) {
207
207
// Writing it
@@ -246,9 +246,10 @@ public static function computeCropAndScale($origWidth, $origHeight, $maxWidth, $
246
246
$ rc = new \stdClass ;
247
247
if ($ options == NULL ) $ options = self ::cropAndScaleOptions ();
248
248
249
-
250
249
// Assume X scaling to maxWidth
251
- $ rc ->factor = $ maxWidth / $ origWidth ;
250
+ $ factorX = $ maxWidth / $ origWidth ;
251
+ $ factorY = $ maxHeight / $ origHeight ;
252
+ $ rc ->factor = $ factorX ;
252
253
253
254
// Positioning for cropping
254
255
$ rc ->x = 0 ;
@@ -260,6 +261,7 @@ public static function computeCropAndScale($origWidth, $origHeight, $maxWidth, $
260
261
$ rc ->options = $ options ;
261
262
262
263
if ($ rc ->height < $ maxHeight ) {
264
+ \TgLog \Log::error ('path1 ' );
263
265
// scale up and crop along X axis
264
266
$ rc ->factor = $ maxHeight / $ origHeight ;
265
267
$ rc ->width = $ rc ->factor * $ origWidth ;
0 commit comments