laravel - PHP create image file using imagecreatefromstring, without knowing the format of the image -


i'm developing laravel restful app accepts image strings users , must store them.
images encoded , sent app. know have receive , decode image this:

$imagedata = base64_decode($imagedata); $source = imagecreatefromstring($imagedata); 

but dont know how save them files, without knowing format of image?is there way find out image extension, can use functions like:
imagepng


Comments