File tree Expand file tree Collapse file tree 2 files changed +14
-31
lines changed Expand file tree Collapse file tree 2 files changed +14
-31
lines changed Original file line number Diff line number Diff line change @@ -55,21 +55,16 @@ public function getResize()
55
55
56
56
public function performResize ()
57
57
{
58
- $ img = request ('img ' );
59
58
$ dataX = request ('dataX ' );
60
59
$ dataY = request ('dataY ' );
61
60
$ height = request ('dataHeight ' );
62
61
$ width = request ('dataWidth ' );
63
- $ image_path = public_path () . $ img ;
62
+ $ image_path = parent :: getCurrentPath ( request ( ' img ' )) ;
64
63
65
- try {
66
- event (new ImageIsResizing ($ image_path ));
67
- Image::make ($ image_path )->resize ($ width , $ height )->save ();
68
- event (new ImageWasResized ($ image_path ));
69
- return parent ::$ success_response ;
70
- } catch (Exception $ e ) {
71
- return "width : " . $ width . " height: " . $ height ;
72
- return $ e ;
73
- }
64
+ event (new ImageIsResizing ($ image_path ));
65
+ Image::make ($ image_path )->resize ($ width , $ height )->save ();
66
+ event (new ImageWasResized ($ image_path ));
67
+
68
+ return parent ::$ success_response ;
74
69
}
75
70
}
Original file line number Diff line number Diff line change 41
41
<button class =" btn btn-primary" onclick =" doResize()" >{{ trans (' laravel-filemanager::lfm.btn-resize' ) } } </button >
42
42
<button class =" btn btn-info" onclick =" loadItems()" >{{ trans (' laravel-filemanager::lfm.btn-cancel' ) } } </button >
43
43
44
+ <input type =" hidden" id =" img" name =" img" value =" {{ $img -> name } }" >
44
45
<input type =" hidden" name =" ratio" value =" {{ $ratio } }" ><br >
45
46
<input type =" hidden" name =" scaled" value =" {{ $scaled } }" ><br >
46
47
<input type =" hidden" id =" original_height" name =" original_height" value =" {{ $original_height } }" ><br >
70
71
});
71
72
72
73
function doResize () {
73
- $ .ajax ({
74
- type: " GET" ,
75
- dataType: " text" ,
76
- url: " {{ route (' unisharp.lfm.performResize' ) } }" ,
77
- data: {
78
- img: ' {{ parse_url ($img -> url , PHP_URL_PATH ) } }' ,
79
- working_dir: $ (" #working_dir" ).val (),
80
- dataX: $ (" #dataX" ).val (),
81
- dataY: $ (" #dataY" ).val (),
82
- dataHeight: $ (" #height" ).val (),
83
- dataWidth: $ (" #width" ).val ()
84
- },
85
- cache: false
86
- }).done (function (data ) {
87
- if (data == " OK" ) {
88
- loadItems ();
89
- } else {
90
- notify (data);
91
- }
92
- });
74
+ performLfmRequest (' doresize' , {
75
+ img: $ (" #img" ).val (),
76
+ dataX: $ (" #dataX" ).val (),
77
+ dataY: $ (" #dataY" ).val (),
78
+ dataHeight: $ (" #height" ).val (),
79
+ dataWidth: $ (" #width" ).val ()
80
+ }).done (loadItems);
93
81
}
94
82
</script >
You can’t perform that action at this time.
0 commit comments