I am trying to do a script image upload using laravel 4. (using the Resource Controller) and I am using the Intervention Image package.
And I want: when loading an image, to save it as 3 different images (different sizes).
eg:
1-Foo-original.jpg
1-Foo-thumbnail.jpg
1-Foo-resized.jpg
This is what I got so far .. it does not work or something else, but that was how much I could handle it.
if(Input::hasFile('image')) { $file = Input::file('image'); $fileName = $file->getClientOriginalName(); $fileExtension = $file->getClientOriginalExtension(); $type = ????; $newFileName = '1' . '-' . $fileName . '-' . $type . $fileExtension; $img = Image::make('public/assets/'.$newFileName)->resize(300, null, true); $img->save(); }
Hope someone can help me, thanks!
source share