Support the ongoing development of Laravel.io →
Input Database Validation
Last updated 2 years ago.
0

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);
Last updated 8 years ago.
0

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. :)

0

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);
Last updated 8 years ago.
0

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 put

use 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.

0

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 !

0

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?

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

taneoboy taneoboy Joined 6 Feb 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.