PHP's imagecreatefromstring function not working on Amazon Linux Server -
i have created script in have create image @ runtime using 64bitencoded string .i m using imagecreatefromstring function of php works in windows xampp based php , not on cloud side applications deployed on amazon cloud running suse version of linux.
can u give me suggestion overcome problem. or there other function capable create image encoded string passed it.
thanks in adv
i using following code
<?php require ('../dbconfig/dbconfig.php'); $gameid = $_post["gameid"]; $username = $_post['email']; $imagedata = $_post['imagedata']; $uploaddir = './../blogdata/i/'; $countsql = mysql_query("select max(_id) filename blog_data "); while($rowcommentdata = mysql_fetch_assoc($countsql)) { $num = $rowcommentdata["filename"]; $file = ++$num.".png"; $filedb = $uploaddir .$file; } /* $imagedata= 'ivborw0kggoaaaansuheugaaabwaaaascamaaab/2u7waaaabl' . 'bmveuaaad///+l2z/daaaasuleqvr4xqwquqoaiaxc2/0vxzdr' . 'ex4ijtrkb7lobnustxsb0jixiamssqnwlsv+wulf4avk9flq2r' . '8a5hse35q3eo2xp1a1wqkzsgetvdtkdqaaaabjru5erkjggg==';*/ $imagedata= base64_decode($imagedata); if(($img = @imagecreatefromstring($imagedata)) !== false) { if(imagepng($img,$filedb)) { imagedestroy($img); $sql="insert blog_data (game_id,text,type,username)". "values('$gameid','$file','i','$username')"; $result=mysql_query($sql); if($result == 1) { echo $file; } else { echo "error2"; } } else { echo "error1"; } } else { echo "error0"; }
?>
by running php info there got information
the php needs have libgd extension installed , loaded. check phpinfo() if it's there. can install via yum. package should called php5-gd
Comments
Post a Comment