I have a schedule on my console\kernel.php
like this:
$client = new Client;
// I use GuzzleHttp\Client because I can't turn `allow_url_fopen` on
$response = $client->get($image_url);
$body = $response->getBody();
$str = (string) $body;
$image = Image::make($str);
It works well with smaller images (~<200KB), but on files with ~>200KB, the last line crashes without any error logs.
I also tried to get strlen($str)
to compare its length with remote file's bytes right before $image = Image::make($str);
. it was okay even with a file with 898,357 bytes
size and returned 898357
.
I tried to use this code in web.php
to debug in this way:
$client = new Client;
$response = $client->get($image_url);
$body = $response->getBody();
$str = (string) $body;
$image = Image::make($str);
return $image->response('jpg', 70);
It works well even with large images, but in this way:
$client = new Client;
$response = $client->get($image_url);
$body = $response->getBody();
$str = (string) $body;
$image = Image::make($str);
return $image->response();
It just responses for small files and crashes on large files.
Are there any ways to fix this?