Function imagecreatefromgif does not take

Asked

Viewed 60 times

1

I’m trying to use this function but I don’t know if I’m using it the right way

<?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 it doesn’t take, this image I put is just an example because I’m going to take the data coming from a variable later to mount the image.

NOTE: The error is that only a square image error appears.

  • Not what? not missing an echo at the end? what (not) happens?

  • The error is that there is only one square image error type appearing.

  • Neither putting echo does not appear the generated image

1 answer

1


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

After picking it up 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);

?>
  • I only have one question now and if the image I use is like this,

  • I tried boot imagecreatefromgif - imagecreatefromjpeg - imagecreatefrompng and nothing that can be?

  • This happens because the image is created by a script too. I do not know at the moment rescue the image when the situation is this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.