gpt4 book ai didi

php - 如何使用 BLOB 值在 TCPDF 中显示图像

转载 作者:行者123 更新时间:2023-11-29 04:23:03 25 4
gpt4 key购买 nike

TCPDF:如何使用从 MySQL 数据库检索到的 BLOB 值在 TCPDF 中显示图像?

最佳答案

来自 example #9 - Image() :

// Example of Image from data stream ('PHP rules')
$imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');

// The '@' character is used to indicate that follows an image data stream and not an image file name
$pdf->Image('@'.$imgdata);

API documentation for Image()更详细地解释它:

$file (string) Name of the file containing the image or a '@' character followed by the image data string. To link an image without embedding it on the document, set an asterisk character before the URL (i.e.: *http://www.example.com/image.jpg).

关于php - 如何使用 BLOB 值在 TCPDF 中显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18184024/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com