Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

EbrahemSamer's avatar

Why image removed after using it One time PHP && TCPDF ?

I am using TCPDF to generate pdf files and i am using image as a background and it works fine for one time after that it removed from the server ?

my code

class MYPDF extends TCPDF {

public function Header() {

    $bMargin = $this->getBreakMargin();

    $auto_page_break = $this->AutoPageBreak;

    $this->SetAutoPageBreak(false, 0);

    $img_file = 'upload/pdf_image.jpeg';

    $this->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);

    $this->SetAutoPageBreak($auto_page_break, $bMargin);

    $this->setPageMark();

    

}

}

0 likes
1 reply
bobbybouwmann's avatar

The image shouldn't be deleted AFAIK. It's also a pretty old library, so it might be worth it to look into something else ;)

Please or to participate in this conversation.