0

I am following the Laracast tutorial for handling image manipulation using Intervention. After adding it to my composer file and running composer update, I added it to my service providers and aliases as instructed in the installation guide. Also, I'm using Vagrant 1.7.4 and a Laravel virtual box called, Scotch Box 2.5.

However, I have not been able to successfully use Intervention in my app. Here is my sample route:

Route::get('foo', function() {
    $image = Image::make('http://placehold.it/500x500/000/e8117f');
    return Response::make($image->encode('jpg'), 200, ['Content-Type' => 'image/jpeg']);
});

When I visit the page in the browser, all I see is a broken image icon. And I'm really confused as to why the developer inspector tool in Chrome displays:

<img style="-webkit-user-select: none" src="http://192.168.33.10/public/foo">
Rachel
  • 1
  • 4

1 Answers1

0

Instead of returning Response::make, you can just do this:

return $image->response('jpg');

You can also do this:

return $image->response();

By default the response data will be encoded in the type of the current image. If no image type is defined yet, method will return jpeg encoded data.

Source: http://image.intervention.io/api/response

Thomas Kim
  • 15,326
  • 2
  • 52
  • 42
  • I tried these suggestions but get the same results with the broken image. – Rachel Nov 05 '15 at 21:55
  • Very weird... Do you know if you meet the system requirements? PHP >= 5.4, fileinfo extension, and either GD Library (>= 2.0) or Imagick PHP extension (>=6.5.7)? – Thomas Kim Nov 05 '15 at 22:23
  • well according to the [creator](https://box.scotch.io/) of the virtual box, it should be using PHP 5.6, GD and Imagick. – Rachel Nov 06 '15 at 21:42