Я изменил размер аватара пользователя с помощью intervention image на странице account.php из плагина rainlab / user, я пытаюсь сохранить его в базе данных octobercms следующим образом:
if (Input::hasFile('avatar')) {
$file = Input::file('avatar');
$filenamewithextension = $file->getClientOriginalName();
//get filename without extension
$filename = pathinfo($filenamewithextension, PATHINFO_FILENAME);
//get file extension
$extension = $file->getClientOriginalExtension();
//filename to store
$filenametostore = $filename.'_'.time().'.'.$extension;
Storage::put('public/profile_images/'. $filenametostore, fopen($file, 'r+'));
Storage::put('public/profile_images/thumbnail/'. $filenametostore, fopen($file, 'r+'));
//Resize image here
$thumbnailpath ='storage/app/public/profile_images/thumbnail/'.$filenametostore;
$img = Image::make($file->getRealPath());
$img->crop(request('w'), request('h'), request('x1'), request('y1'));
$img->save($thumbnailpath);
$user->avatar = $filenametostore;
}
Я получаю такую ошибку:
The avatar must be an image.
C:\wamp643\www\october3\vendor\october\rain\src\Database\Traits\Validation.php line 340






Вы должны пройти абсолютный путь к модельным отношениям.
Из документы:
You may also pass a string to the data attribute that contains an absolute path to a local file.
$model->avatar = Input::file('file_input');
Итак, в вашем случае:
$user->avatar = Storage::get('public/profile_images/'. $filenametostore);