rose8383 Posted November 4, 2013 Share Posted November 4, 2013 Hi, 1) I'm trying to save the url of a qr code into a directory (/home/inforlix/public_html/O/QR_Code/image.png). 2) Then i want the codes to write the image.png into my database under field name imagePNG Here's my code: <?php //if ($_POST['submit']) { if ($_SESSION['MM_Username']) { //$msg = $_REQUEST['msg']; $msg= $row_RSU['QR_CODES']; $url = 'http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl='.$msg; // initialize cURL settings $ch = curl_init ($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // fetch raw data $rawdata = curl_exec($ch); curl_close($ch); // convert it to a GD image and save $img = imagecreatefromstring($rawdata); // now save a copy of the new image to the cache directory imagePNG($img, '/home/inforlix/public_html/O/QR_Code/image.png'); print '<center><img src="http://inforlix.com/O/QR_Code/image.png"><br>'; //print('<font color=#30afd8><H2>Saved QR Code.</H2></font>'); imagedestroy($img); } ?> Unfortunately, the field imagePNG is still null in value. Please advise. Link to comment https://forums.phpfreaks.com/topic/283576-qr-code-saving-the-url-to-directory-and-then-save-the-image-on-directory-into-database/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.