@@ -280,15 +280,15 @@ public function output($image_type = null, $quality = null)
280280 public function resizeToShortSide ($ max_short , $ allow_enlarge = false )
281281 {
282282 if ($ this ->getSourceHeight () < $ this ->getSourceWidth ()) {
283- $ ratio = $ height / $ this ->getSourceHeight ();
283+ $ ratio = $ max_short / $ this ->getSourceHeight ();
284284 $ width = $ this ->getSourceWidth () * $ ratio ;
285285
286- $ this ->resize ($ width , $ height , $ allow_enlarge );
286+ $ this ->resize ($ width , $ max_short , $ allow_enlarge );
287287 } else {
288- $ ratio = $ height / $ this ->getSourceWidth ();
288+ $ ratio = $ max_short / $ this ->getSourceWidth ();
289289 $ width = $ this ->getSourceHeight () * $ ratio ;
290290
291- $ this ->resize ($ width , $ height , $ allow_enlarge );
291+ $ this ->resize ($ width , $ max_short , $ allow_enlarge );
292292 }
293293
294294 return $ this ;
@@ -304,15 +304,15 @@ public function resizeToShortSide($max_short, $allow_enlarge = false)
304304 public function resizeToLongSide ($ max_long , $ allow_enlarge = false )
305305 {
306306 if ($ this ->getSourceHeight () > $ this ->getSourceWidth ()) {
307- $ ratio = $ height / $ this ->getSourceHeight ();
307+ $ ratio = $ max_long / $ this ->getSourceHeight ();
308308 $ width = $ this ->getSourceWidth () * $ ratio ;
309309
310- $ this ->resize ($ width , $ height , $ allow_enlarge );
310+ $ this ->resize ($ width , $ max_long , $ allow_enlarge );
311311 } else {
312- $ ratio = $ height / $ this ->getSourceWidth ();
312+ $ ratio = $ max_long / $ this ->getSourceWidth ();
313313 $ width = $ this ->getSourceHeight () * $ ratio ;
314314
315- $ this ->resize ($ width , $ height , $ allow_enlarge );
315+ $ this ->resize ($ width , $ max_long , $ allow_enlarge );
316316 }
317317
318318 return $ this ;
0 commit comments