UniSharp /
laravel-filemanager
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace UniSharp\LaravelFilemanager\Controllers; |
||||||
| 4 | |||||||
| 5 | use Intervention\Image\Facades\Image as InterventionImageV2; |
||||||
| 6 | use Intervention\Image\Laravel\Facades\Image as InterventionImageV3; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 7 | use UniSharp\LaravelFilemanager\Events\ImageIsCropping; |
||||||
| 8 | use UniSharp\LaravelFilemanager\Events\ImageWasCropped; |
||||||
| 9 | |||||||
| 10 | class CropController extends LfmController |
||||||
| 11 | { |
||||||
| 12 | /** |
||||||
| 13 | * Show crop page. |
||||||
| 14 | * |
||||||
| 15 | * @return mixed |
||||||
| 16 | */ |
||||||
| 17 | public function getCrop() |
||||||
| 18 | { |
||||||
| 19 | return view('laravel-filemanager::crop') |
||||||
|
0 ignored issues
–
show
The function
view was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 20 | ->with([ |
||||||
| 21 | 'working_dir' => request('working_dir'), |
||||||
|
0 ignored issues
–
show
The function
request was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 22 | 'img' => $this->lfm->pretty(request('img')) |
||||||
|
0 ignored issues
–
show
The method
pretty() does not exist on null.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
The property
lfm does not exist on UniSharp\LaravelFilemana...trollers\CropController. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||||
| 23 | ]); |
||||||
| 24 | } |
||||||
| 25 | |||||||
| 26 | /** |
||||||
| 27 | * Crop the image (called via ajax). |
||||||
| 28 | */ |
||||||
| 29 | public function getCropImage($overWrite = true) |
||||||
| 30 | { |
||||||
| 31 | $image_name = request('img'); |
||||||
|
0 ignored issues
–
show
The function
request was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 32 | $image_path = $this->lfm->setName($image_name)->path('absolute'); |
||||||
|
0 ignored issues
–
show
The property
lfm does not exist on UniSharp\LaravelFilemana...trollers\CropController. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||||
| 33 | $crop_path = $image_path; |
||||||
| 34 | |||||||
| 35 | if (! $overWrite) { |
||||||
| 36 | $fileParts = explode('.', $image_name); |
||||||
| 37 | $fileParts[count($fileParts) - 2] = $fileParts[count($fileParts) - 2] . '_cropped_' . time(); |
||||||
| 38 | $crop_path = $this->lfm->setName(implode('.', $fileParts))->path('absolute'); |
||||||
| 39 | } |
||||||
| 40 | |||||||
| 41 | event(new ImageIsCropping($image_path)); |
||||||
|
0 ignored issues
–
show
The function
event was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 42 | |||||||
| 43 | $crop_info = request()->only('dataWidth', 'dataHeight', 'dataX', 'dataY'); |
||||||
| 44 | |||||||
| 45 | // crop image |
||||||
| 46 | if (class_exists(InterventionImageV2::class)) { |
||||||
| 47 | InterventionImageV2::make($image_path) |
||||||
| 48 | ->crop(...array_values($crop_info)) |
||||||
| 49 | ->save($crop_path); |
||||||
| 50 | } else { |
||||||
| 51 | InterventionImageV3::read($image_path) |
||||||
| 52 | ->crop(...array_values($crop_info)) |
||||||
| 53 | ->save($crop_path); |
||||||
| 54 | } |
||||||
| 55 | |||||||
| 56 | // make new thumbnail |
||||||
| 57 | $this->lfm->generateThumbnail($image_name); |
||||||
| 58 | |||||||
| 59 | event(new ImageWasCropped($image_path)); |
||||||
| 60 | } |
||||||
| 61 | |||||||
| 62 | public function getNewCropImage() |
||||||
| 63 | { |
||||||
| 64 | $this->getCropimage(false); |
||||||
| 65 | } |
||||||
| 66 | } |
||||||
| 67 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths