tcpdf - Display image in TCPDF using BLOB value

The API documentation for Image() explains it in more detail:

  • $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

From example #9 - Image():

1
2
3
4
5
// 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);