J
For budyaga/yii2-cropper, the code worked a little bit.yii2-cropper/actions/UploadAction.php $model->{$this->uploadParam}->name = uniqid() . '.' . $model->{$this->uploadParam}->extension;
$request = Yii::$app->request;
$width = $request->post('width', $this->width);
$height = $request->post('height', $this->height);
$file = $file->tempName . $request->post('filename');
$width_original = getimagesize($file)[0];
$ratioSize = $width_original / 250;
$w = $width_original / (250 / intval($request->post('w')));
$answerX = $request->post('x') * $ratioSize;
$answerY = $request->post('y') * $ratioSize;
$image = Image::crop(
$file,
$w,
$w,
[$answerX, $answerY]
)->resize(
new Box($width, $height)
);
I'll explain a little: there was no relationship between the downloaded image and displayed in the field and the cutting used the coordinates of the miniature derogates instead of the original.
If someone wants to refine the code under the universal, please drop the answer... I hope someone helped!