This package does not work on Laravel 5.2 all of a sudden. It used to work fine before, but now it does not generate images. The following code:
Route::get('test', function() {
$img = \Image::make(public_path().'/images/image-square.png')->resize(300, 200);
return $img->response('jpg');
});
Used to work just fine, but now it fails resulting in this:

Whats wrong?
Any updates on this? Really causing a lot of troubles - no images what so ever on our production server.
Interesting; if I inspect the image, the source is http://domain.app/test (the name of the current route). Don't know if it has anything to say.

Also tried pulling down dev-master; same issue.
Running php7, don't know if it has anything to say. Using GD driver; tried using Imageick as well, but same issue.
Running "$img->save('test.png');" works fine
Any updates on this? We're several people experincing this issue, and only solution I see so far is to get rid of the package. That would be a huge shame though, as it is hardly implemented into our application. We've been using Image intervention for more than a year.
Can't reproduce your error. It would help, if you can post further information like errors in log file or the actual output of the route. (broken image can be anything).
I'd be happy to post anything you'd like. Using this piece of code (verifying that the image source actually exists), a white image is returned:
Route::get('test', function() {
$img = \Image::make(public_path().'/images/athliit-square.png')->resize(300, 200);
return $img->response('png');
});
laravel.log is empty, nginx server logs produce nothing.
I can tell I am running php7 on latest homestead, latest vagrant version and latest virtualbox. No idea if that is worth anything. Issue persists on staging and production environments.
_However_ curling the route gives me some kind of PNG output. See:


I have uploaded the file it generates here: http://www.filedropper.com/test_40 (the blank/white image that is returned)
Interesting. If I am using Laravel's native methods to return the response, it does not work either.
return response(File::get(public_path().'/images/my-image.png'), 200)->header('Content-Type', 'image/png');
I have verified the image exists, and is readable. If I dd File::get(public_path().'/images/my-image.png') I get PNG data...
So if this is not working ...
return response(File::get(public_path().'/images/my-image.png'), 200)->header('Content-Type', 'image/png');
... the problem must be something else than Intervention Image.
Maybe it's PHP 7, I tried your code on my PHP 5 installation and it works fine.
yeah I guess you are right.
Maybe this could be something?

I'll check it out
Might be. I wouldn't use PHP 7 in production at this point. Too many things are still missing.
Interesting.. Too little too late, but let's see....
Just tested updating to php 7.0.2, no luck!
As @Snapey says, it must be because of some extra character that mess with the output. Next issue: how do we find this character that is outputted by mistake by the application? It could be a whitespace or similar, but I have no clue where to start looking. Maybe some smart pcregrep search?
An example, where response works fine:
$img = \Image::make(public_path().'/images/my-image.png')->resize(300, 200);
$response = $img->response('png');
ob_end_clean(); // if I remove this, it does not work
return $response;
Okay, so after hours of debugging the issue is solved.. Wow.. A single tab in a config file.
Did the following regex search \t<\?php and that solved it for me... sorry for all the confusion!
I'm encountering the same issue, do you know what config file was the culprit? I can output config('image.driver') just fine.
In my specific case it was a config file. It can be any file in your application. You need to figure some smart way to find that character.
Try doing:
Route::get('/test-empty-response', function()聽{ return ''; });
Is the response REALLY empty? Or is there an extra character, or tab, or whatever.
Great observation, turns out one of the packages I was using (hampel/tlds) had an extra space in their config file.
removing BOM on files also work, tried the option on webstorm 11, right click on folder project on project window and then click the option "remove BOM"
Same error, mine was because there was a newline before the <?php tag in the app.php file. Once I removed it, it started working.
Only happening on Windows.
Most helpful comment
Okay, so after hours of debugging the issue is solved.. Wow.. A single tab in a config file.
Did the following regex search
\t<\?phpand that solved it for me... sorry for all the confusion!