@@ -201,7 +201,7 @@ public static function cropAndScale($imagePath, $variation, $newHeight, $newWidt
201201 $ height = $ image ->getImageHeight ();
202202 $ actions = self ::computeCropAndScale ($ width , $ height , $ newWidth , $ newHeight , $ options );
203203 if ($ actions ->scale != 1 ) {
204- $ image ->scaleImage ($ actions ->factor * $ width , 0 );
204+ $ image ->scaleImage ($ actions ->factor * $ width , $ actions -> factor * $ height );
205205 }
206206 if ($ image ->cropImage ($ actions ->width , $ actions ->height , $ actions ->x , $ actions ->y )) {
207207 // Writing it
@@ -246,9 +246,10 @@ public static function computeCropAndScale($origWidth, $origHeight, $maxWidth, $
246246 $ rc = new \stdClass ;
247247 if ($ options == NULL ) $ options = self ::cropAndScaleOptions ();
248248
249-
250249 // Assume X scaling to maxWidth
251- $ rc ->factor = $ maxWidth / $ origWidth ;
250+ $ factorX = $ maxWidth / $ origWidth ;
251+ $ factorY = $ maxHeight / $ origHeight ;
252+ $ rc ->factor = $ factorX ;
252253
253254 // Positioning for cropping
254255 $ rc ->x = 0 ;
@@ -260,6 +261,7 @@ public static function computeCropAndScale($origWidth, $origHeight, $maxWidth, $
260261 $ rc ->options = $ options ;
261262
262263 if ($ rc ->height < $ maxHeight ) {
264+ \TgLog \Log::error ('path1 ' );
263265 // scale up and crop along X axis
264266 $ rc ->factor = $ maxHeight / $ origHeight ;
265267 $ rc ->width = $ rc ->factor * $ origWidth ;
0 commit comments