开发者

FPDF Image from Dynamic Source. php/png/pdf. Can't get image to work

开发者 https://www.devze.com 2023-03-26 12:05 出处:网络
http://babymoments.co/preview/highres%20preview/5_357/ According to the FPDF documentation here: http://www.fpdf.org/en/doc/image.htm

http://babymoments.co/preview/highres%20preview/5_357/

According to the FPDF documentation here: http://www.fpdf.org/en/doc/image.htm You are supposed to be able to use an Image from a dynamic source.. however, as per the first link, i'm getting an fopen error.

Any suggestions?

Code Snippet:

// Overlay Text & Images
$pdf->Image($conf['rbase'].'page_maker/image_hr.php?id=5&side=1&bg=cover_pink&lo=0_1&imgtxt=0|0|u5_1310329746.jpg@@1|1|Elina\'s Puppies 9/2/2010|15|arial_bi.ttf|db0ddb|fedfe4&applet_ty开发者_如何学Pythonpe=cover',$sx,$sh,(0-$dpi), 0, 'png');


You are trying to open a local php file with get parameters - try instead to open the image file as a url. For example :

http://domain.com/image.php?id=5

Or in your case...

http://babymoments.co/preview/page_maker/image_hr.php?id=5&side=1&bg=cover_pink&lo=0_1&imgtxt=0|0|u5_1310329746.jpg@@1|1|Elina's%20Puppies%209/2/2010|15|arial_bi.ttf|db0ddb|fedfe4&applet_type=cover


I wouldn't fetch the preview over HTTP but would include the required code and generate the image in the same script that generates the PDF. That way there is no problems with setups that have disabled fopen()-usage with URLs.


I was implementing a barcode for a label printer. So I was using the 'barcodegen' library and 'fpdf' library for this project, but I was having problems including dynamically the image generated with barcodegen, giving me the following error:

FPDF error: Not a PNG file: ./misc/barcodegen/mostrar-codigo-bcgcode39.php

Afeter that, I use one of the answers described here, and I solved the problem using the full URL of the image, like this:

$pdf->Image("http://localhost/caaf/misc/barcodegen/mostrar-codigo-bcgcode39.php",0,0,20,0,'PNG');

And it worked for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消