php - 一些图像显示,一些图像不显示(Broken X)

标签 php laravel pdf yii2 mpdf

一些图像显示和一些图像不显示(Broken X)代码在下面,而且我正在使用 xampp 5(mpdf)....

 if(!empty($row["google_address"])){
            $address =  $row["google_address"].'<br>'.'/'.'Lat - '.$row["latitude"].' / '.'Long - '.$row["longitude"];
            }else{
                $address ='';
            }
                $table .= '<tr>';
                    $table .= "<td>".$i++."</td>";
                    $table .= "<td>".$row["name"]."</td>";
                    $table .= "<td>".$row["mobile"]."</td>";
                    $table .= "<td>".$row["organization_name"]."</td>";
                    $table .= "<td>".$row["beatName"]."</td>";
                    $table .= "<td>".$row["customer_type"]."</td>";
                    $table .= "<td>".$i_Type."</td>";
                    $table .= "<td>".$row["intration_date"]."</td>";
                    $table .= "<td>".$row["next_activity_at"]."</td>";
                    $table .= "<td>".$row["call_time"]."</td>";
                    $table .= "<td>".$row["purpose"]."</td>";
                    $table .= "<td>".$row["status"]."</td>";
                    $table .= "<td>".$vIn."</td>";
                    $table .= "<td>".$vOut."</td>";
                    $table .= "<td>".$row["remark"]."</td>";
                    $table .= "<td>".$row["rating"]."</td>";
                    $table .= "<td>".str_replace('\' ', '\'', ucwords(str_replace('\'', '\' ', strtolower($row["fname"]))))."</td>";
                    $table .= "<td>".$address."</td>";

                    // $pathe = \Yii::getAlias('@web/uploads/crm_images/');
                    // $img = $row["visit_image"] ? ' <img src = "'.$pathe.$row["visit_image"].'" width ="200px" height = "200px">' : '';
                    
                    // $img = $remark1[0]['image_one'] ? ' <img src = "https://timekompas.com/backend/web/uploads/task_photo/'.$remark1[0]['image_one'].'" width ="80px" height = "80px">' : '';
                    $img = $row["visit_image"] ? ' <img src = "https://timekompas.com/backend/web/uploads/crm_images/'.$row["visit_image"].'" width ="200" height = "200">' : '';
                    //echo $row["visit_image"];
                    //echo $img;
                    //die;
                    $table .="<td>".$img."</td>";

mpdf 代码 (Xampp 5) :-

 $path = \Yii::getAlias("@vendor/MPDF/mpdf.php");
        require_once($path);
        $mpdf = new \mPDF('en-GB-x', 'A4-L', '', '', 5, 5, 5, 5, 6, 3);
        // $mpdf->curlAllowUnsafeSslRequests = true;
        // $mpdf->showImageErrors = true;
        // $mpdf->debug = true;
        $mpdf->packTableData = true;
        $mpdf->SetDisplayMode('fullpage');
        $mpdf->SetFooter('Contact no: +91-771-4700067, 7772800067 Email ID: timekompas@entitcs.com');
        $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
       // if($_SESSION["isSupAdmin"]=='1')
       // {
      //  $mpdf->SetWatermarkText('TIME KOMPAS');
      //  }
       // else
      //  {
         //   $mpdf->SetWatermarkText('TIME KOMPAS');
         // $mpdf->SetWatermarkText($_SESSION["timecampus_officename"]);
        if($_SESSION["ofc_new_com"] != '' && $_SESSION["ofc_new_name"] != ''){
            
            $mpdf->SetWatermarkText($_SESSION["ofc_new_com"].'( '.$_SESSION["ofc_new_name"].' )');
        }
        if(($_SESSION['order_detail'] != '')||($_SESSION['taskreport_sql'] != '')){
            $employee =\Yii::$app->session->get('empdata');
            $office = Yii::$app->db->createCommand("select ofc_name,company_name from master_office where ofc_id = '".$employee['employee']['emp_ofcid']."' ")->queryOne();
            $mpdf->SetWatermarkText($office["company_name"].'( '.$office["ofc_name"].' )');
        }
     

        //}
        /* $table .=$_SESSION['khumesh_map']; */
        //$mpdf->SetWatermarkText($_SESSION['ofc_new_com']);
      
        $mpdf->showWatermarkText = true;
        $mpdf->watermarkTextAlpha = 0.3;
        $mpdf->simpleTables = true;
        $mpdf->WriteHTML($table);
        $mpdf->Output($filename . '.pdf', 'I');
        
        exit;

问题图片(在我的图片中,一张图片显示,一张图片显示 x,而第二张图片是空白的,因为它是空的。)

enter image description here

我怎样才能解决那个问题来解决我的问题

最佳答案

该代码很好,但存在图像大小问题,图像大小超过 20 kb 这是一个原因

关于php - 一些图像显示,一些图像不显示(Broken X),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74532239/

相关文章:

php - 使用 PHP 压缩的文件在提取后生成 cpgz 文件

python - 引发运行时错误 ('FPDF error: ' +msg) 运行时错误 : FPDF error: Unsupported image type: chapter_1_romance_dawn

ruby-on-rails - wicked_pdf 多页文档

php - 如何访问本身是另一个对象的属性的对象的静态属性?

php - Laravel 5.5 枢轴连接以获取主 MySQL 结果的枢轴值

php - 无法连接到 Google 云 SQL。使用 PHP 谷歌 SDK

php - 如何从 Laravel 集合中获取多维关联数组的值

php - 使用外键复制 - Laravel

php - 优化 Laravel 中的 UpdateOrCreate

json - 如何使用 Nodejs 将 json 数据导出为指定格式的 pdf 文件?