Skip to content

Commit c906601

Browse files
committed
Fix cropping not work on Windows
1 parent 7249307 commit c906601

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

src/controllers/CropController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ public function getCrop()
3131
*/
3232
public function getCropimage()
3333
{
34-
$image = request('img');
3534
$dataX = request('dataX');
3635
$dataY = request('dataY');
3736
$dataHeight = request('dataHeight');
3837
$dataWidth = request('dataWidth');
39-
$image_path = public_path() . $image;
38+
$image_path = parent::getCurrentPath(request('img'));
4039

4140
event(new ImageIsCropping($image_path));
4241
// crop image

src/views/crop.blade.php

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
<button class="btn btn-primary" onclick="performCrop()">{{ trans('laravel-filemanager::lfm.btn-crop') }}</button>
3434
<button class="btn btn-info" onclick="loadItems()">{{ trans('laravel-filemanager::lfm.btn-cancel') }}</button>
35-
<form action="{{ route('unisharp.lfm.getCrop') }}" role='form' name='cropForm' id='cropForm' mathod='post'>
35+
<form id='cropForm'>
3636
<input type="hidden" id="img" name="img" value="{{ $img->name }}">
3737
<input type="hidden" id="working_dir" name="working_dir" value="{{ $working_dir }}">
3838
<input type="hidden" id="dataX" name="dataX">
@@ -80,22 +80,14 @@ function changeAspectRatio(_this, aspectRatio) {
8080
return false;
8181
}
8282
function performCrop() {
83-
$.ajax({
84-
type: "GET",
85-
dataType: "text",
86-
url: "{{ route('unisharp.lfm.getCropimage') }}",
87-
data: {
88-
img: '{{ parse_url($img->url, PHP_URL_PATH) }}',
89-
working_dir: $("#working_dir").val(),
90-
dataX: $("#dataX").val(),
91-
dataY: $("#dataY").val(),
92-
dataHeight: $("#dataHeight").val(),
93-
dataWidth: $("#dataWidth").val(),
94-
type: $('#type').val()
95-
},
96-
cache: false
97-
}).done(function (data) {
98-
loadItems();
99-
});
83+
performLfmRequest('cropimage', {
84+
img: $("#img").val(),
85+
working_dir: $("#working_dir").val(),
86+
dataX: $("#dataX").val(),
87+
dataY: $("#dataY").val(),
88+
dataHeight: $("#dataHeight").val(),
89+
dataWidth: $("#dataWidth").val(),
90+
type: $('#type').val()
91+
}).done(loadItems);
10092
}
10193
</script>

0 commit comments

Comments
 (0)