Hey there, I am using your package along with the new version of Laravel (5.2) and I am getting and empty content (blank image) using the example that you got posted on your web site.
Example:
// create a new image resource
$img = Image::canvas(800, 600, '#ff0000');
// send HTTP header and output image data
header('Content-Type: image/png');
echo $img->encode('png');
I do not know why it happens because I have the same controller doing the duty with the before Laravel version and it works fine.
any guide will be great.
thanks!
Any error messages in log files?
No bud.. There is not logs at all. that's why I came up to you guys. I am still having the issue
Hard to remote debug your application without any further information. Have you tried to use Laravel's own HTTP response classes instead?
Yes sir, I have tried everything I could and found as solutions around the web. This is my implementation, nothing major because I wanted to see if the error was in the app itself
Route:
Route::get('image/{file?}', 'FileController@image')->where('file', '(.*)');
Controller:
public function image(Request $request, $file)
{
$path = storage_path() . '/files/'. $file;
echo $path;
$img = \Image::make($path);
// dd($img);
// $img = \Image::canvas(800, 600, '#ff0000');
// $img->save($path.'hey.png');
return \Image::make($path)->response('png');
// header('Content-Type: image/png');
// echo $img->encode('png');
// dd($img);
// $response = \Response::make($img)->header('Content-Type', 'image/png');
// // set content-type
// // $response->header('Content-Type', 'image/png');
// dd($response);
// return $response;
// dd($file, $path, $response);
}
I left the comments to see if you can be guided out.
Thanks
I just tried your example with Laravel 5.2 on my machine and it works fine. The last thing I can think of is a memory issue, if you're trying to load a large image, your PHP instance may be crashing without an error because it runs out of memory set by memory_limit in your php.ini settings.
Memory Settings: http://image.intervention.io/getting_started/configuration
it is so weird because my memory limit is set up to 512M. I have the same package working fine with a previous version of Laravel.
I am trying to have this running after I updated to the 5.2. is there something different to be aware of? any other ideas
Maybe set it even higher. Sorry, but I think I can't help you.
yes, i know it is a weird error.. I also tried changing my memory_limit to 32M as it is said on the web site,but still nothing happened..
Thanks.. hopefully somebody else can have an clue about it.
@olivervogel You were right my friend, there is something going on in my local box.. I just tested the example on line and it is working well.. Thanks for the guiding!
hey there, i have upgrade my vagrant & homestead and I have the issue yet... another suggestion for this crazy scenario?
Same issue here - both locally and on production. No images. See:
https://github.com/Intervention/image/issues/501
Response output:

Laravel 5.2
I still have that issue.. I assume that is Laravel version, but nobody else says anything and that's why that I am looking for another solution.. if ya'll find something, please, post it out
I recently updated my virtual box to 5.0.
Since then I have this error as well and I'm still on L5.0.
My homestead is 0.2.5. and my Vagrant version is 1.8.1
I haven't found a solution yet. I keep you updated.
Any progress on this? I'm having the same issue.
It is okay if I try to generate an image using only GD, for example:
<?php
header("Content-Type: image/png");
$im = @imagecreate(500, 500) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 50, 5, 5, "It works", $text_color);
imagepng($im);
but when I try to create an canvas or show an image using the library, i get only an empty square, like in the previous comments:
<?php
include '../vendor/autoload.php';
$manager = new \Intervention\Image\ImageManager(['driver' => 'gd']);
$img = $manager->canvas(500, 500, '#FF0000');
$response = $img->response('png');
var_dump($response);
@angelov be sure to check for any whitespace outside any
In a app/config.php-file, I had a tab character before the PHP tag started, and that caused the empty square, because it conflicted with the image data.
A way to test this, could be to make a route that returns nothing, and then inspect the source to check if the output is actually empty as expected. If not, good luck finding that space/tab/whatever.
@canfiax you were right, there was some whitespace. Thank you.
Have this issue earlier, try to check the buffer and confirmed a white space.
After fixing the white space everything back to normal.
Thanks @canfiax.
Hey, same issue here with Laravel 5.2. Really horrible experience. I'm stuck with this error since 4 hours now. How can it be that it shows nothing, just a blank page??!
I have isolated my code to a few lines. The error (or whatever it might be) happens only when the line starting with "$imageObj2" is executed. My php.ini memory_limit is set to 128M. Both images loaded by the script have less than 5 MB together.
I appreciate your suggestions.
$imageObj1 = Image::make('imagepath/image1');
echo "hello";
$imageObj2 = Image::make('imagepath/image2'); // when I comment this line, both "hellos" are echoed. When the line is executed, I see only one "hello" and nothing else (no error).
echo "hello";
(... one hour later:)
After almost five hours and changing several php.ini directives, it was actually the "memory_limit" directive. After changing the setting from 128M to 1000M, it finally worked! All this precious time on a Thursday night ... for nothing. I would never have thought that processing 2 files which have together less than 5 MB needs more than 128M of memory. Maybe the Intervention image documentation should be more explicit about the memory size that must be set to work properly. Currently it says that "Resizing a 3000 x 2000 pixel image to 300 x 200 may take up to 32MB memory." In my code example, I didn't resize anything, I just loaded two images (2160 x 3840) and even 128MB wasn't enough.
Thanks so much @angelov
That's was the problem..
@simplenotezy You saved my life! For me, it's the imagecache.php file itself...
I couldn't find where the whitespace was being added so I used ob_clean() to empty the output buffer at the start of my controller method.
Most helpful comment
@angelov be sure to check for any whitespace outside any
In a
app/config.php-file, I had a tab character before the PHP tag started, and that caused the empty square, because it conflicted with the image data.A way to test this, could be to make a route that returns nothing, and then inspect the source to check if the output is actually empty as expected. If not, good luck finding that space/tab/whatever.