Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
362 views
in Technique[技术] by (71.8m points)

php - PHP / FPDF:如何在单元格中插入图像?(PHP / FPDF: How to insert image at cell?)

I want to display image from MySQL to PDF using FPDF library.

(我想使用FPDF库显示从MySQL到PDF的图像。)

the image that i stored in MySQL is BLOB.

(我存储在MySQL中的图像是BLOB。)

I already success to display the image.

(我已经成功显示了图像。)

The current code will be like this.

(当前代码将是这样。)

    $logo = $row['photo_before'];
    $pdf->MemImage(base64_decode($logo), 100, 50);

But, how I want to put the $logo to a cell?

(但是,我如何将$ logo放在单元格中?)

My current code for the cell as below:

(我当前的单元格代码如下:)

    $pdf->Cell(95,50,'$logo',1,0, 'C');

Can anyone help me?

(谁能帮我?)

  ask by Radamel Falcao translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can create a cell like:

(您可以创建一个像这样的单元:)

//Cell
Cell(float w [, float h [, string txt [, mixed border [, int ln [, string align [, 
boolean fill [, mixed link]]]]]]])

Then create image in same position:

(然后在相同位置创建图像:)

//Image
 Image(string file [, float x [, float y [, float w [, float h [, string type [, mixed 
 link]]]]]])

Or:

(要么:)

$image1 = "img/image1.jpg";
 $this->Cell( 40, 40, $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 33.78), 0, 0, 'L', false );

Edit you code:

(编辑您的代码:)

$pdf->Cell(95,50,$pdf->MemImage(base64_decode($logo), 100, 50),1,0, 'C');

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...