File tree Expand file tree Collapse file tree 4 files changed +29
-3
lines changed Expand file tree Collapse file tree 4 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,27 @@ public function
8000
getResize()
52
52
->with ('ratio ' , $ ratio );
53
53
}
54
54
55
- public function performResize ()
55
+ public function performResize ($ overWrite = true )
56
56
{
57
+ $ image_name = request ('img ' );
57
58
$ image_path = $ this ->lfm ->setName (request ('img ' ))->path ('absolute ' );
59
+ $ resize_path = $ image_path ;
60
+
61
+ if (! $ overWrite ) {
62
+ $ fileParts = explode ('. ' , $ image_name );
63
+ $ fileParts [count ($ fileParts ) - 2 ] = $ fileParts [count ($ fileParts ) - 2 ] . '_resized_ ' . time ();
64
+ $ resize_path = $ this ->lfm ->setName (implode ('. ' , $ fileParts ))->path ('absolute ' );
65
+ }
58
66
59
67
event (new ImageIsResizing ($ image_path ));
60
- Image::make ($ image_path )->resize (request ('dataWidth ' ), request ('dataHeight ' ))->save ();
68
+ Image::make ($ image_path )->resize (request ('dataWidth ' ), request ('dataHeight ' ))->save ($ resize_path );
61
69
event (new ImageWasResized ($ image_path ));
62
70
63
71
return parent ::$ success_response ;
64
72
}
73
+
74
+ public function performResizeNew ()
75
+ {
76
+ $ this ->performResize (false );
77
+ }
65
78
}
Original file line number Diff line number Diff line change @@ -364,7 +364,10 @@ public static function routes()
364
364
'uses ' => 'ResizeController@performResize ' ,
365
365
'as ' => 'performResize ' ,
366
366
]);
367
-
367
+ Route::get ('/doresizenew ' , [
368
+ 'uses ' => 'ResizeController@performResizeNew ' ,
369
+ 'as ' => 'performResizeNew ' ,
370
+ ]);
368
371
// download
369
372
Route::get ('/download ' , [
370
373
'uses ' => 'DownloadController@getDownload ' ,
Original file line number Diff line number Diff line change 67
67
'btn-cancel ' => 'Cancel ' ,
68
68
'btn-confirm ' => 'Confirm ' ,
69
69
'btn-resize ' => 'Resize ' ,
70
+ 'btn-resize-copy ' => 'Copy & Resize ' ,
70
71
'btn-open ' => 'Open Folder ' ,
71
72
72
73
'resize-ratio ' => 'Ratio: ' ,
Original file line number Diff line number Diff line change 59
59
</table >
60
60
<div class =" d-flex mb-3" >
61
61
<button class =" btn btn-secondary w-50 mr-1" onclick =" loadItems()" >{{ trans (' laravel-filemanager::lfm.btn-cancel' ) } } </button >
62
+ <button class =" btn btn-warning w-50 mr-1" onclick =" doResizeNew()" >{{ trans (' laravel-filemanager::lfm.btn-resize-copy' ) } } </button >
62
63
<button class =" btn btn-primary w-50" onclick =" doResize()" >{{ trans (' laravel-filemanager::lfm.btn-resize' ) } } </button >
63
64
</div >
64
65
@@ -120,4 +121,12 @@ function doResize() {
120
121
dataWidth: $ (" #width" ).val ()
121
122
}).done (loadItems);
122
123
}
124
+
125
+ function doResizeNew () {
126
+ performLfmRequest (' doresizenew' , {
127
+ img: $ (" #img" ).val (),
128
+ dataHeight: $ (" #height" ).val (),
129
+ dataWidth: $ (" #width" ).val ()
130
+ }).done (loadItems);
131
+ }
123
132
</script >
You can’t perform that action at this time.
0 commit comments