@@ -802,7 +802,7 @@ public function onResizeImage()
802
802
$ path = Input::get ('path ' );
803
803
$ path = MediaLibrary::validatePath ($ path );
804
804
805
- $ croppedPath = $ this ->resizeImage (MediaLibrary:: url ( $ path) , [
805
+ $ croppedPath = $ this ->resizeImage ($ path , [
806
806
'mode ' => 'exact ' ,
807
807
'width ' => $ width ,
808
808
'height ' => $ height
@@ -1325,14 +1325,14 @@ protected function generateThumbnail($thumbnailInfo, $thumbnailParams = null): a
1325
1325
/*
1326
1326
* Resize the thumbnail and save to the thumbnails directory
1327
1327
*/
1328
- $ fullThumbnailPath = $ this ->resizeImage (MediaLibrary:: url ( $ path) , $ thumbnailParams );
1328
+ $ fullThumbnailPath = $ this ->lazyResizeImage ( $ path , $ thumbnailParams );
1329
1329
1330
1330
/*
1331
1331
* Delete the temporary file
1332
1332
*/
1333
1333
$ markup = $ this ->makePartial ('thumbnail-image ' , [
1334
1334
'isError ' => false ,
1335
- 'imageUrl ' => $ this -> getThumbnailImageUrl ( $ fullThumbnailPath)
1335
+ 'imageUrl ' => $ fullThumbnailPath
1336
1336
]);
1337
1337
} catch (\Throwable $ ex ) {
1338
1338
$ markup = $ this ->makePartial ('thumbnail-image ' , ['isError ' => true ]);
@@ -1353,10 +1353,26 @@ protected function generateThumbnail($thumbnailInfo, $thumbnailParams = null): a
1353
1353
/**
1354
1354
* Resize an image
1355
1355
*/
1356
- protected function resizeImage (string $ image , array $ params ): string
1356
+ protected function lazyResizeImage (string $ path , array $ params ): string
1357
+ {
1358
+ return ImageResizer::filterGetUrl (
1359
+ MediaLibrary::url ($ path ),
1360
+ $ params ['width ' ],
1361
+ $ params ['height ' ],
1362
+ array_merge (
1363
+ ['mode ' => 'exact ' ],
1364
+ $ params
1365
+ )
1366
+ );
1367
+ }
1368
+
1369
+ /**
1370
+ * Resize an image
1371
+ */
1372
+ protected function resizeImage (string $ path , array $ params ): string
1357
1373
{
1358
1374
return ImageResizer::processImage (
1359
- $ image ,
1375
+ MediaLibrary:: url ( $ path ) ,
1360
1376
$ params ['width ' ],
1361
1377
$ params ['height ' ],
1362
1378
array_merge (
@@ -1370,10 +1386,10 @@ protected function resizeImage(string $image, array $params): string
1370
1386
/**
1371
1387
* Crop an image
1372
1388
*/
1373
- protected function cropImage (string $ image , array $ params ): string
1389
+ protected function cropImage (string $ path , array $ params ): string
1374
1390
{
1375
1391
return ImageResizer::processImage (
1376
- $ image ,
1392
+ MediaLibrary:: url ( $ path ) ,
1377
1393
$ params ['width ' ],
1378
1394
$ params ['height ' ],
1379
1395
array_merge (
@@ -1423,7 +1439,7 @@ protected function getCropEditImageUrlAndSize($path, $params = null)
1423
1439
$ url = MediaLibrary::url ($ path );
1424
1440
1425
1441
if ($ params ) {
1426
- $ url = $ this ->resizeImage ($ url , [
1442
+ $ url = $ this ->resizeImage ($ path , [
1427
1443
'mode ' => 'exact ' ,
1428
1444
'width ' => $ params ['width ' ],
1429
1445
'height ' => $ params ['height ' ],
0 commit comments