php
  • image
  • mysqli
  • blob
  • fpdf
  • 2017-08-22 81 views 0 likes 
    0

    這裏是我的代碼 - >進步,report.php 數據類型LONGBLOB,API是FPDF如何在fpdf中查看longbob圖片?

    $res=mysqli_query($conn,"SELECT school_logo FROM dsms_school_img"); 
    while($row=mysqli_fetch_array($res)) 
    { 
        $logo = '<img src="data:image/jpeg;base64,'.base64_encode($row['school_logo']).'"/>'; 
    } 
    

    當我把這個$logo$pdf->Image($logo,10,10,188);它表明這個錯誤:

    Fatal error: Uncaught Exception: FPDF error: Image file has no extension and no type was specified: <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/4QECRXhpZgAATU0AKgAAAAgABAEPAAIAAAAGAAAAPgEQAAIAAAAPAAAARIKaAAUAAAABAAAAU4dpAAQAAAABAAAAWwAAAABDYW5vbgBDYW5vbiBFT1MgMTAwRAAAAAABAAAAoAAHgpoABQAAAAEAAACxgp0ABQAAAAEAAAC5iCcAAwAAAAIAZAAAkAMAAgAAABQAAADBkgkAAwAAAAIAEAAAkgoABQAAAAEAAADVpDQAAgAAAB0AAADdAAAAAQAAAKAAAAA4AAAACjIwMTc6MDE6MDYgMTY6MDc6MDkAAAAANwAAAAFFRi1TMTgtNTVtbSBmLzMuNS01LjYgSVMgU1RNAP/bAEMABQMEBAQDBQQEBAUFBQYHDAgHBwcHDwsLCQwRDxISEQ8RERMWHBcTFBoVEREYIRgaHR0fHx8TFyIkIh4kHB4fHv/bAEMBBQUFBwYHDggIDh4UERQeHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHv/AABEIAVQB/gMBIgACEQEDEQH/xAAdAAACAgMBAQEAAAAAAAAAAAADBAIFAAEGBwgJ/8QAQhAAAQQBAwMDAgQDBgQEBgMAAQACAxEEBRIhBjFBE1FhInEHFDKBI5GhFUJiscHwCFLR4RYkM1NDcoKDkvEXY6L/xAAbAQACAwEBAQAAAAAAAAAAAAACAwABBAUGB//EADMRAAICAQQBAwIFAQgDAAAAAAABAgMRBBIhMUEFE1EiYRQycYHw0RUjQpGhscHhM1Lx/9oADAMBAAIRAxEAPwD6O1LUA9xLqBXNaplsddPSmo55t1OVFlZu4nlfKXlnt6oRqWEEz5zzTrVNPLRW in C:\xampp\htdocs\dignitysmslatest\admin\Module\manage\pdf\fpdf.php on line 271 
    

    回答

    0

    內存映像支持

    信息

    作者:奧利維爾 許可證:FPDF 描述

    此腳本允許顯示加載到內存中的圖像,而不需要臨時文件。主要有兩種用途:

    • 當圖像被從數據庫
    • 裝載當用GD

    創建的圖像加載到一個字符串的圖像:

    MemImage(字符串數據[,float x [,float y [,float w [,float h [,mixed link]]]]])

    對於GD圖像:

    GDImage(資源im [,float x [,float y [,float w [,float h [,mixed link]]]]])

    其中im是GD標識符。如果你使用JpGraph,你可以通過調用$ graph-> Stroke(_IMG_HANDLER)來獲取它。

    $query = "SELECT school_logo FROM dsms_school_img"; 
        $result = mysqli_query($query); 
        $row = mysql_fetch_assoc($result); 
        $image = $row['imageField']; 
    
        $pdf->MemImage($image, 50, 30); 
    
    +0

    你爲什麼用'mysql'例子來回答使用'mysqli'的問題? – Naktibalda

    +0

    已編輯只是一個錯字 –

    +0

    這將是更好的解釋山姆做錯了什麼。 – Naktibalda

    相關問題