0

this is the code that i use to get the image:

$img = \Image::make($ad['image_url']);
return $img->response();

it works, the only thing is that the image returned is static.

When opening the real image url in a tab, it's animated

is there a way to get the animated result?

DomeWTF
  • 2,342
  • 4
  • 33
  • 46

3 Answers3

1

Thank you all, I solved it using another answer here on stackoverflow

$remoteImage = "http://www.example.com/gifs/logo.gif";
$imginfo = getimagesize($remoteImage);
header("Content-type: {$imginfo['mime']}");
readfile($remoteImage);

this returns the correct format

this is the url to the other answer from robjmills

Show image using file_get_contents

DomeWTF
  • 2,342
  • 4
  • 33
  • 46
0

I think intervention library doesn't support animated Gif you may try other libraries directly like imagik or gd as given below https://github.com/Intervention/image/issues/176

fayis003
  • 680
  • 4
  • 10
0

Send the mime type also in response()

$img = \Image::make($ad['image_url']);
return $img->response($img->mime());

response() method takes two parameter mimetype and quality in integer

Hope this helps.

FULL STACK DEV
  • 15,207
  • 5
  • 46
  • 66
  • how would i go about uploading this to S3. I need to get a stream to upload but when i get stream directly i loose the animation. The code already uses Image::make to resize and manipulate the image so i'd prefer to leave that code in. – Xitcod13 Nov 22 '21 at 21:53