Home > Enterprise >  Qr code is image not showing even libraries are included
Qr code is image not showing even libraries are included

Time:02-03

My Qr code is not working. I have already included my libraries consisting of CIqrcode and the qrcode. Is there anything that i missed? Any guides will be appreciated. Thank you

enter image description here enter image description here enter image description here

Controller:

class Testingpage extends CI_Controller{
    
    function __construct(){
        parent::__construct();
        $this->load->model('Testingpagemodels');
        $this->load->library('Ciqrcode');
        

      
    }

    function QRcode($try){
        
        
        QRcode::png(
            $try,
            $outfile = false,
            $level = QR_ECLEVEL_H,
            $size= 5,
            $margin =2,
            );
    
     
    }
    
    public function fetchqr()
    {
        
        
        $list = $this->Testingpagemodels->get_datatables_testing();
        $json = array();
        $no = $_POST['start'];
        foreach ($list as $rows) {
         
            $no  ;
            $first=$rows->ID_NUMBER;
            
            $json[]=array(
                '<tr><th><center><img src="testingpage/QRcode/'.$first.'" width="110px"><br>'.$rows->NAME.'<br>'.$rows->DEPARTMENT.'</center></th>', //I'm calling the function of my QR here.

                
            );
     

   
    }
    
    $output = array(
        "draw" => $_POST['draw'],
        "recordsTotal" => $this->Testingpagemodels->count_all_testing(),
        "recordsFiltered" => $this->Testingpagemodels->count_filtered_testing(),
        "data" => $json,
    );
    //output to json format
    echo json_encode($output);
}
 

CodePudding user response:

My Dear friend you did not mention your environment is local or live in case of the production server that might be the extension issue.to avoid that use the below mention code to display your image.

                  <?php
                    // $path is path where your image is stored.
                    $path = "assets/custom/img/img.jpg";
                    $type = pathinfo($path, PATHINFO_EXTENSION);
                    $file_data = file_get_contents($path);
                    $base64_img = 'data:image/' . $type . ';base64,' . 
                    base64_encode($file_data);
                    ?>

CodePudding user response:

Solved.

From my "Config" i have deleted this:

From

$autoload['helper'] = array('url','html','email');

To

$autoload['helper'] = array('url','html');

Now it is working. Anyone who can help me why it is an error when I include it in autoload? Is there a conflict between qrcode and email? Thank you.

  •  Tags:  
  • Related