Create image response from session which contain Intervention/Image object failed?

77 views Asked by At

I save intervention image in session, I would like to use it later,

but I get imagesx() expects parameter 1 to be resource, integer given

Here is my code

$data = Session::get('custom_ad');
$payment = $data['paymentReport'];
$img = $payment->resize(600, 380);
return $img->response('jpg');

$payment is from session which contain intervention object.

When I var_dump($payment) I get this

object(Intervention\Image\Image)#299 (9) { ["driver":protected]=> object(Intervention\Image\Gd\Driver)#300 (2) { ["decoder"]=> object(Intervention\Image\Gd\Decoder)#301 (1) { ["data":"Intervention\Image\AbstractDecoder":private]=> NULL } ["encoder"]=> object(Intervention\Image\Gd\Encoder)#302 (4) { ["result"]=> string(77771) "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgD/9k=" ["mime"]=> string(10) "image/jpeg" ["dirname"]=> string(4) "/tmp" ["basename"]=> string(9) "phpXGXn33" ["extension"]=> NULL ["filename"]=> string(9) "phpXGXn33" }

What I want is create image response, or save file later.

Where I'm doing wrong?

Thanks in advance.

0

There are 0 answers