Image Uploads

PHP lets people upload files and with Intervention Image you can easily pass an uploaded image to the make() method. The standard way is to get the temp. file information from the $_FILES array.

Read more about file uploads in the official PHP documentation.

Creating Image from File Upload

  1. // read image from temporary file
  2. $img = Image::make($_FILES['image']['tmp_name']);
  3. // resize image
  4. $img->fit(300, 200);
  5. // save image
  6. $img->save('foo/bar.jpg');

Handling image uploads in Laravel

In a Laravel application it is also possible to pass an uploaded file directly to the make method.

Creating Image from File Upload in Laravel

  1. // resizing an uploaded file
  2. Image::make(Input::file('photo'))->resize(300, 200)->save('foo.jpg');