Function imagecreatefromgif does not handle [closed]

1

I'm trying to use this function but I do not know if I'm using the correct way I wanted to know what I'm missing

<?php
header("Content-Type: image/png");
?>
<?php
header("Content-Type: image/GIF");
?>

<?php

$img = imagecreatefromgif("https://pbs.twimg.com/profile_images/657537129241825280/9vpxbnIi_normal.png");

ImageGif ($img);    

?>

I'm using the function like this but do not get it, this image I uploaded is just an example because I'm going to get the data coming from a variable later to mount the image.

NOTE: The error that is left is only a square image error type appearing.

    
asked by anonymous 04.04.2016 / 16:35

1 answer

1

It does not catch because the link image is PNG and you are using the function to get it in GIF.

Once you get it you can convert it to GIF.

<?php

header("Content-Type: image/gif");

$img = imagecreatefrompng("http://pbs.twimg.com/profile_images/657537129241825280/9vpxbnIi_normal.png");

imagegif ($img);

?>
    
04.04.2016 / 16:45