Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php gd imagecreatefromstring() and image mime type

Tags:

mime-types

php

gd

is there a way to use imagecreatefromstring() and get somehow what is the image type?

like image 381
Marcin Avatar asked Nov 13 '22 18:11

Marcin


1 Answers

When you use imagecreatefrom... methods, the image is loaded into memory as the uncompressed bitmap. there is not really a image type at this point. you can save it back out as whatever type you wish using the image... function.

$img = imagecreatefromstring($data);

imagepng($img, "file path and name");

imagedestroy($img);

http://us2.php.net/manual/en/function.imagecreatefromstring.php

like image 83
Bueller Avatar answered Dec 20 '22 06:12

Bueller