php - Getting extension of an image from base64 encoded string -Cakephp -


iam doing apis of ios application in cakephp.iam getting base64 encoded string request parameter.how can find extension of image(png,jpeg) string.

first need decode string can extract extension string. code example below should work you.

$filename = base64_decode($encoded);  $extension = substr($filename, strpos($filename, ".") + 1);  echo $extension; 

lee


Comments

Popular posts from this blog

jquery - isAjaxRequest always return false -

php - SPIP: From Tag directly to an article -