0

Подскажите, загружаю фото на сервер через ajax, вот контроллер:

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Intervention\Image\ImageManager;


class ClientDataController extends Controller {


    public function index() {
        
        return view('client-data');
    }

    public function upload_pass(Request $request)
    {
        foreach ($request->file() as $file) {
            $f = $file->move(storage_path('files'), time().'_'.$file->getClientOriginalName());
            $manager = new ImageManager(array('driver' => 'gd'));

            $image = $manager->make($f)->resize(100, 100);
            $put = storage_path('files');
            $file_name = time().'_'.$file->getClientOriginalName();
            $data = $put.$file_name;
            $image->save($data, 60);

            return $data;
        }
    }

}

?>

Нужно картинку которую передаю изменить resize() и вернуть путь измененной картинки на клиент, подозреваю что в моем коде не срабатывает save()/ Заранее спасибо за ответ

1 ответ 1

0

Вам нужно вернуть:

return $image->save($data, 60);

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.