Deks Posted September 20, 2011 Share Posted September 20, 2011 Hello there, i have small problem and i need little help. Let me explain situation. I have some table and like u see am putting some extension on name every time i put new data. Problem is that i need to make QRcode from ID. Am trying with ever new insert which am putting in database, also in same time make QRcode picture of ID and save that picture (name will be "currentID.jpg") in some folder. $q1= mysql_query("SELECT MAX(ID) FROM custombtn"); while($myrow1 = mysql_fetch_assoc($q1)) { $row1 = $myrow1['MAX(ID)'];} $name = $_REQUEST['name']; $date1 = date('Y-m-d'); if(isset($row1)){ $q2= mysql_query("SELECT * FROM custombtn WHERE ID = '$row1'", $con); //$con = connection //start for qrcode $qr = new qrcode(); $qr->link("http://www.mypage.com/myproject/check.php?ID=".$row1); $file= $qr->get_image(); $qr->download_image($file); imagejpeg($image,"image/".$row1.".jpg",100); //end while($myrow2 = mysql_fetch_assoc($q2)) { $row2 = $myrow2['name']; list($name1) = preg_split('[-]', $row2); } $extension = $name.'-'.$name1; }else{ $extension = $name.'-app'; //some UPDATE commands } Here is link for qrcode.php generator download which someone put on sourceforge and am trying to use it. http://sourceforge.net/projects/phpqrcode/files/releases/phpqrcode-2010100721_1.1.4.zip/download I hope my code is understandable and someone will help me. Thanks lot. Quote Link to comment https://forums.phpfreaks.com/topic/247522-qr-code/ Share on other sites More sharing options...
Deks Posted September 23, 2011 Author Share Posted September 23, 2011 I found solution. <? function filecopy($urlsrc,$localdst) { $fp_urlsrc = fopen($urlsrc,"r"); $del_File = fopen($localdst,"w"); fwrite($del_File,""); fclose ($del_File); while (!feof($fp_urlsrc)) { $fp_localdst = fopen($localdst,"a"); fwrite ($fp_localdst, fread($fp_urlsrc, 1)); fclose ($fp_localdst); } fclose($fp_urlsrc); } function archive(){ set_time_limit(120); $source = "http://chart.apis.google.com/chart?chs=150x150&cht=qr&chld=L|0&chl=http://www.myproject.com/project1/check.php?ID=79"; $dest = "slike/79.jpeg"; $fd = fopen("$source", "r" ) or die("<center>Unable to access source page</center>"); $pagina = fread($fd, 200000); echo "pagina=$pagina"; fclose( $fd ); if (file_exists($dest)) { if (intval(date("Ymd", filectime($dest)))< intval(date("Ymd"))) { filecopy($source,$dest); } } else { filecopy($source,$dest); } } archive(); ?> Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/247522-qr-code/#findComment-1271987 Share on other sites More sharing options...
Mavent Posted September 23, 2011 Share Posted September 23, 2011 Glad you found it. I wrote nearly the exact code last year, only I'm saving a .pdf instead of a .jpg. Mine's up at www.qrah.net if you're interested in seeing how someone else tackled it. Quote Link to comment https://forums.phpfreaks.com/topic/247522-qr-code/#findComment-1272038 Share on other sites More sharing options...
Deks Posted September 27, 2011 Author Share Posted September 27, 2011 Hello, am still on that problem. :-\ Code i gave works on my pc perfectly, but when i try to put it on linux server or windows server there starts problems. I cant open webpage because i get error Fatal error: Maximum execution time of 30 seconds exceeded and it tells how it cant be connected to host or on web location. I tried with changing max_execution_time in php.ini ...but no effects. Can anyone know whats problem? Quote Link to comment https://forums.phpfreaks.com/topic/247522-qr-code/#findComment-1273234 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.