PHP:$pdf->;图像崩溃(TCPDF)

PHP:$pdf->;图像崩溃(TCPDF),php,pdf,tcpdf,Php,Pdf,Tcpdf,我正在使用TCPDF和FPDI创建一个新的PDF,并希望在整个页面上添加一个图像(具有alpha透明度)。 奇怪的是,TCPDF有时会创建一个PDF,有时会在没有错误的情况下崩溃(即,除了标准响应头(用于文本/html)之外,根本不会生成任何输出)。它始终取决于我传递给图像函数的维度: $this->Image($markupfile,0,0,120, 50, 'png', '', '', true, 300); 不过,它可以工作(尽管图像太小) 没有。原始尺寸为宽度:96

我正在使用TCPDF和FPDI创建一个新的PDF,并希望在整个页面上添加一个图像(具有alpha透明度)。 奇怪的是,TCPDF有时会创建一个PDF,有时会在没有错误的情况下崩溃(即,除了标准响应头(用于文本/html)之外,根本不会生成任何输出)。它始终取决于我传递给图像函数的维度:

       $this->Image($markupfile,0,0,120, 50, 'png', '', '', true, 300);
不过,它可以工作(尽管图像太小)

没有。原始尺寸为宽度:968px;高度:685px

    require_once "config/sessions_class.php";
    require_once "config/sanitation_class.php";
    require_once('tcpdf/tcpdf.php');
    require_once('tcpdf/config/lang/eng.php');
    require_once('FPDF/fpdi.php');
    require_once('config/settings.php');
    require_once('phpfpm/pdfVersion.php');



 class concatPdf extends FPDI{

     ....

    function concat() {
                $dir = $this->dir;
                $pagecount = $this->setSourceFile($dir.$this->file);
                for ($i = 1; $i <= $pagecount; $i++) {
                    $this->_tplIdx = $this->importPage($i);
                    $s = $this->getTemplatesize($this->_tplIdx);
                    $this->AddPage($s['w'] > $s['h'] ? 'L' : 'P', array($s['w'], $s['h']));
                    $this->useTemplate($this->_tplIdx);
                    $markupfile = "markups/".$this->pdfid."_".$i.".png";
                    if ( file_exists  ($markupfile)) {
                           $this->Image($markupfile,0,0,1020, 50, 'png', '', '', true, 300);

                    }

                 }

     }

     ....

  }



    $filename;
    $pdf = new concatPdf();

    $pdf->setImageScale(1.53);
    $pdf->SetAutoPageBreak(true, 40);
    $pdf->setFontSubsetting(false);
    $pdf->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT);

    $pdf->concat();

    $pdf->Output('ed_'."filename", 'I');
require_once“config/sessions_class.php”;
需要_once“config/environment_class.php”;
一次需要_('tcpdf/tcpdf.php');
只需要一次('tcpdf/config/lang/eng.php');
一次需要_('FPDF/fpdi.php');
需要_once('config/settings.php');
一次需要_('phpfpm/pdfVersion.php');
类concatPdf扩展了FPDI{
....
函数concat(){
$dir=$this->dir;
$pagecount=$this->setSourceFile($dir.$this->file);
对于($i=1;$i\u tplIdx=$this->importPage($i);
$s=$this->getTemplatesize($this->\u tplIdx);
$this->AddPage($s['w']>$s['h']?'L':'P',数组($s['w'],$s['h']);
$this->usemplate($this->\u tplIdx);
$markupfile=“markups/”$this->pdfid.200;“$i.”.png”;
如果(文件_存在($markupfile)){
$this->Image($markupfile,0,01020,50,'png','',true,300);
}
}
}
....
}
$filename;
$pdf=新的concatPdf();
$pdf->setImageScale(1.53);
$pdf->SetAutoPageBreak(真,40);
$pdf->setFontSubsetting(假);
$pdf->SetMargins(左、40、右);
$pdf->concat();
$pdf->Output('ed_.),'filename','I');

这么大的图像不就是达到了
内存\u的极限吗?有趣的想法,让我检查一下……回音内存\u get\u用法()输出27958520-是否太多?限制设置为128MI只是增加了内存限制并将其设置为512MB,仍然是相同的问题。27958520字节大约为26MB,因此我认为内存不应该是问题。
    require_once "config/sessions_class.php";
    require_once "config/sanitation_class.php";
    require_once('tcpdf/tcpdf.php');
    require_once('tcpdf/config/lang/eng.php');
    require_once('FPDF/fpdi.php');
    require_once('config/settings.php');
    require_once('phpfpm/pdfVersion.php');



 class concatPdf extends FPDI{

     ....

    function concat() {
                $dir = $this->dir;
                $pagecount = $this->setSourceFile($dir.$this->file);
                for ($i = 1; $i <= $pagecount; $i++) {
                    $this->_tplIdx = $this->importPage($i);
                    $s = $this->getTemplatesize($this->_tplIdx);
                    $this->AddPage($s['w'] > $s['h'] ? 'L' : 'P', array($s['w'], $s['h']));
                    $this->useTemplate($this->_tplIdx);
                    $markupfile = "markups/".$this->pdfid."_".$i.".png";
                    if ( file_exists  ($markupfile)) {
                           $this->Image($markupfile,0,0,1020, 50, 'png', '', '', true, 300);

                    }

                 }

     }

     ....

  }



    $filename;
    $pdf = new concatPdf();

    $pdf->setImageScale(1.53);
    $pdf->SetAutoPageBreak(true, 40);
    $pdf->setFontSubsetting(false);
    $pdf->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT);

    $pdf->concat();

    $pdf->Output('ed_'."filename", 'I');