Предупреждение: getimagesize (images / IMG_20181017_115937.jpg): не удалось открыть поток: нет такого файла или каталога в C: \ wamp64 \ www \ ... \ FPDF \ fpdf.php - PullRequest
0 голосов
/ 17 октября 2018

У меня ошибка в моем коде.Я загружаю несколько изображений с помощью форума HTML / PHP.Но когда я хочу, чтобы они отображались в моей FPDF, я получаю эту ошибку:

Предупреждение: getimagesize (images / IMG_20181017_115937.jpg): не удалось открыть поток: нет такого файла или каталога в C: \ wamp64\ www \ Petrogas NCR Applicatie \ FPDF \ fpdf.php

Это мой код:

if (mysqli_query($conn, $sql)) {

    $query = "SELECT id FROM ncr_input ORDER BY id DESC LIMIT 1";
    $result = mysqli_query($conn, $query);

    $row = mysqli_fetch_row($result);

    $ncrnummer = $row[0];

    for($i = 0; $i < count($_FILES['attachments']['name']); $i++)
    {
        $filetmp = $_FILES["attachments"]["tmp_name"][$i];
        $filename = $_FILES["attachments"]["name"][$i];
        $filepath = "images/".$filename;

        move_uploaded_file($filetmp,$filepath);

        $querypictureupload = "INSERT INTO file_upload (ncrnummer,filename) VALUES ('$ncrnummer','$filename')";
        $result = mysqli_query($conn, $querypictureupload);
    }

    ob_start();
    $pdf = new FPDF();

    $pdf->AddPage();

    $pdf->Rect(10, 10, 190, 186, 'D');

    $pdf->Image("sitephotos/Petrogaslogo.jpg",11,11,35,17.5,"JPG");

    $pdf->SetFont("Helvetica", "B", 15);
    $pdf->Cell(0,20, "{$typencr}",1,1, 'C');
    $pdf->SetFont("Arial", "B", 10);

    $pdf->Cell(47.5,10,"Brief description:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$categorie}", 0 ,0);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Drawingnr:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$tekeningnr}", 0 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"P.G. reference:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$projectnummer}", 0 ,0);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Contact person:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$projectleider}", 0 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Project description:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$projectnaam}", 0 ,0);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Department:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$waargeconstateerd}", 0 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(190,10,"Description of Non - Conformity / Complaint:", 1 ,1);
    $pdf->SetFont("Arial", "", 8);
    $pdf->MultiCell(190,4, "{$omschrijvingprobleem}\n\n",0,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(190,10,"Analysis of the cause of Non - Conformity / Complaint:", 1 ,1);
    $pdf->SetFont("Arial", "", 8);
    $pdf->MultiCell(190, 4, "{$omschrijvingoorzaak}\n\n",0,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Deviation caused by:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$veroorzaaktdoor}", 0 ,0);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Supplier:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$klant}", 0 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Report by:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$gerapporteerddoor}", 0 ,0);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Date:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"-", 0 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Proposed disposition:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$correctiemaatregelen}", 0 ,0);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Planned completion:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$geplandedatumgereed}", 0 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Action by:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$corractiedoor}", 0 ,0);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Estimated costs/hrs:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$geschattekosten} / {$geschatteuren}", 0 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(190,10,"Approval QM     ........                         Approval others     ........                         Acceptance AI     ........", 1 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Identify corrective action", 1 ,0);
    $pdf->SetFont("Arial", "", 12);
    $pdf->Cell(47.5,10,"String maken......", 0 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(190,10,"Reviewed by:                                                                                       Review date:", 1 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(190,10,"Verification QM     ........                         Verification others     ........                         Acceptance AI     ........", 1 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Preventive action:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$preventieveacties}", 0 ,1);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Status:", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"{$status}", 0 ,0);

    $pdf->SetFont("Arial", "B", 10);
    $pdf->Cell(47.5,10,"Date closed", 1 ,0);
    $pdf->SetFont("Arial", "", 8);
    $pdf->Cell(47.5,10,"-", 0 ,1);

    $pdf->AddPage();

    $query1 = "SELECT filename FROM `file_upload` WHERE ncrnummer = '$ncrnummer'";
    $result1 = mysqli_query($conn, $query1);

    while ($row = mysqli_fetch_assoc($result1)) {
        $image = $row['filename'];
        $pdf->Image("images/".$image,NULL , NULL ,100,85, "");
        $pdf->Cell(190, 3, "", 0, 1);
    }

    $pdfdoc = $pdf->Output('', 'S');
    ob_end_flush();

    $mail = new PHPMailer();

    $mail->SMTPDebug = 0;

    $mail->Host = "";
    $mail->isSMTP();
    $mail->SMTPAuth = "";
    $mail->Username = "";
    $mail->Password = "";
    $mail->Port = 25;

    $mail->addAddress($projectleideremail);
    $mail->setFrom('');
    $mail->Subject = "NIEUWE NCR Project: {$projectnummer}";
    $mail->isHTML(true);
    $mail->Body = "DIT IS EEN TEST NCR";
    $mail->addStringAttachment($pdfdoc, 'NCR.pdf');

    if ($mail->send()) {
        echo "<script>alert('Uw e-mail is verstuurd met een attachment')</script>";
    }

Кто-нибудь знаком с кодами ошибок FPDF?

...