Check out Intervention Image here. That should help you work with images with ease.
Sample:
$image = $request->file('image');
$upload = 'uploads/image';
$filename = $image->getClientOriginalName();
/* You can also use the fit(w,h) method, which crops and resizes the image, instead of the resize(w,h) method... */
$img = Image::make($image)->resize(320, 240);
$img->save($upload.'/'.$filename);
Neoglyph said:
Check out Intervention Image here. That should help you work with images with ease.
Sample:
$image = $request->file('image'); $upload = 'uploads/image'; $filename = $image->getClientOriginalName(); /* You can also use the fit(w,h) method, which crops and resizes the image, instead of the resize(w,h) method... */ $img = Image::make($image)->resize(320, 240); $img->save($upload.'/'.$filename);
Here's what the error says: Class 'App\Http\Controllers\Image' not found on Image::make
thank you for helping. :)
If you've included the package in your project, and set it up correctly in the config\app.php
file, don't forget to put
use Image;
in your code, or just use the full namespace, like this
$img = \Intervention\Image\Image::make($image)->resize(320, 240);
Neoglyph said:
If you've included the package in your project, and set it up correctly in the
config\app.php
file, don't forget to putuse Image;
in your code, or just use the full namespace, like this
$img = \Intervention\Image\Image::make($image)->resize(320, 240);
thank you man! i forgot to install the requirements of intervention. probably im not famiiliar using composer.json.
hey mr.Neoglyph may i ask if what code do i use if i want to edit my image?
public function update(Request $request, $id)
{
$image = $request->file('image');
$upload = 'uploads/image';
$filename = $image->getClientOriginalName();
/* You can also use the fit(w,h) method,
which crops and resizes the image, instead of the resize(w,h) method... */
$img = Image::make($image)->resize(200, 200);
$img->save($upload.'/'.$filename);
$datas = Information::find($id);
$datas->idno = Input::get('idno');
$datas->email = Input::get('email');
$datas->image = $filename;
$datas->lname = Input::get('lname');
Thanks !
taneoboy said:
hey mr.Neoglyph may i ask if what code do i use if i want to edit my image?
Not quite sure what you mean by "edit". Care to explain in more detail?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community