yii2-cropper
yii2-cropper copied to clipboard
Hi i'm getting a 404 when i try to cropp de image
I also got "404 Page not found"
Tried to debug and found that Widget::$uploadUrl is appended with "/" and become "/user/user/uploadPhoto/" The enabled option "enableStrictParsing" in my "urlManager" configuration lead to Yii can't parse "/user/user/uploadPhoto/" with extra slash at the end.
To fix it I added url rule with '?' like that
'urlManager' => [
'showScriptName' => false, // Disable index.php
'enablePrettyUrl' => true, // Disable ?r= routes
'enableStrictParsing' => true, // Only routes being listed in rules
'rules' => [
'/uploadUserPhoto?' => '/user/user/uploadPhoto',
And "404 Page not found" issue is solved for me.
I have same problem. When I upload image, and submit button Crop photo, after in console of browser appears such a alert " http://localhost/st2/frontend/web/uploads/post/ Failed to load resource: the server responded with a status of 404 (Not Found) "
<?= $form->field($model, 'image')->widget(Widget::className(), [
'uploadUrl' => Url::toRoute('uploads/post/'),
]) ?>
.
}
public function actions()
{
return [
'uploadPhoto' => [
'class' => 'budyaga\cropper\actions\UploadAction',
'url' => Yii::$app->request->baseUrl.'/uploads/post/thumb',
'path' => Yii::$app->request->baseUrl.'/uploads/post/thumb',
]
];
}
How can I fix it?
Я решил проблему так: В видах указал контроллер загрузки изображений: 'uploadUrl' => '/adminpanel/products/uploadPhoto', А в контроллере в качестве пути сделал: 'path' => $_SERVER['DOCUMENT_ROOT'].'/uploads', https://pastebin.com/jtAXXMaD
Hi i'm getting a 404 when i try to click in crop image.please help me to resolve this issue
just make a page in the controller and receive all information about the image and do all your entries in data base and return 1
use this [https://github.com/rezaei121/yii2-jcrop] ( it works very good)
`` <?= $form->field($model, 'image')->widget(Widget::className(), [
'uploadUrl' =>Yii::$app->urlManager->createUrl('uploads'),
]) ?>``