来自动态源的 FPDF 图像。 php/png/pdf。无法使图像工作
http://babymoments.co/preview/highres%20preview/5_357/
根据FPDF 文档位于:http://www.fpdf.org/en/doc/image.htm 您应该能够使用动态源中的图像..但是,根据第一个链接,我收到 fopen 错误。
有什么建议吗?
代码片段:
// 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_type=cover',$sx,$sh,(0-$dpi), 0, 'png');
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_type=cover',$sx,$sh,(0-$dpi), 0, 'png');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在为标签打印机实现条形码。所以我在这个项目中使用了“barcodegen”库和“fpdf”库,但是我遇到了问题,包括使用barcodegen动态生成的图像,给我以下错误:
FPDF错误:不是PNG文件:./misc/barcodegen /mostrar-codigo-bcgcode39.php
之后,我使用此处描述的答案之一,并使用图像的完整 URL 解决了问题,如下所示:
$pdf->Image("http://localhost/caaf/misc/barcodegen /mostrar-codigo-bcgcode39.php",0,0,20,0,'PNG');
这对我有用。
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.
您正在尝试使用 get 参数打开本地 php 文件 - 尝试以 url 形式打开图像文件。例如:
或者在你的情况下......
You are trying to open a local php file with get parameters - try instead to open the image file as a url. For example :
Or in your case...
我不会通过 HTTP 获取预览,但会包含所需的代码并在生成 PDF 的同一脚本中生成图像。这样,禁用 URL 的 fopen() 使用的设置就不会出现问题。
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.