【问题标题】:FPDF error: Missing or incorrect image file: images/Photo/sample.jpgFPDF 错误:图像文件丢失或不正确:images/Photo/sample.jpg
【发布时间】:2012-07-27 01:33:34
【问题描述】:

我正在从数据库和图像文件夹中获取图像。

现在如果我在文件夹中没有图像,它会给我错误:

FPDF error: Missing or incorrect image file: images/Photo/a.jpg

我正在根据mysql数据库图像字段对文件夹中的图像进行排序。

现在我想要的是,如果文件夹中没有图像或者图像字段为空,它不应该给我这个错误。而是显示文件夹中已经存在的默认图像。

我使用的代码是:

    $pict=$row['pict'];
    $image1 = "images/Photo/$pict";
    $pdf->SetX($xaxis);
    $xaxis=$xaxis-55;
    $yaxis=$yaxis+7;

    $pdf->Cell(0,0,$pdf->Image($image1,$xaxis,$yaxis,25,29),0,0,'L',0);
    $sign=$row['sign'];
    $image2= "images/Signature/$sign";
    $yaxis=$yaxis+35;
    $pdf->Cell(0,0,$pdf->Image($image2,$xaxis,$yaxis,20,0),0,0,'L',0);

【问题讨论】:

    标签: php mysql image pdf fpdf


    【解决方案1】:

    好的。我已经做到了。

    我应该做的就是:

        $pict=$row['pict'];
    
        //$xaxis=43';
    
        $pdf->SetX($xaxis1);
    
        $pdf->Cell(22,80,'-'.$fia2.' '.$sa,0,0,'L',0);
        if (empty($pict))
        {$image1="images/Photo/blank.jpg";}
        else {$image1 = "images/Photo/$pict";}
        $pdf->SetX($xaxis);
        $xaxis=$xaxis-55;
        $yaxis=$yaxis+7;
    
        $pdf->Cell(0,0,$pdf->Image($image1,$xaxis,$yaxis,25,29),0,0,'L',0);
        $signs=$row['sign'];
        if (empty($signs))
        {$image2="images/Signature/blank.jpg";}
        else {$image2 = "images/Signature/$signs";}
    

    【讨论】:

      猜你喜欢
      • 2011-03-11
      • 2014-09-10
      • 2017-09-10
      • 2020-09-19
      • 2017-09-09
      • 2016-05-08
      • 1970-01-01
      • 2022-08-04
      • 2015-12-31
      相关资源
      最近更新 更多