php - Resizing images using Laravel and the Intervention package -
i trying manipulate images in laravel using intervention have followed required set use imagick. use vagrant centos , shows working should via phpinfo ();
when run following (snippit controller)
public function store() { //get user fields $user = new user; $user->username = input::get('username'); $user->name = input::get('name'); $user->email = input::get('email'); $user->gender = input::get('gender'); $user->country = input::get('country'); $user->website = input::get('website'); $user->bio = input::get('bio'); //check , store user image if (input::hasfile('image')) { $image = image::make(input::file('image')); $name = time() . '-' . $image->getclientoriginalname(); $image->resize(100, 100); $image = $image->move(public_path() . '/images/avatars/', $name); $user->image = $name; } $user->save(); return redirect('/admin/users'); }
it expect resize image. image input, assigns new name , saves in right place. when view on page original size.
it without error, unsure whether issue code or on server side.
any appreciated.
i had same problem, , solved using request class , not input.
use request; // or depends of app config // use illuminate\http\request; ... if (request::hasfile('image')) { $image = image::make(request::file('image')); ...
note: in laravel5 docs not use intput anymore: http://laravel.com/docs/5.0/requests , idea use dependency injection can extend , add rules , validations if needed...
Comments
Post a Comment