html2pdf
html2pdf copied to clipboard
Insert image from a data URI
I am trying to use a data URI to display an image but it's throwing an exception that has no error message. I need to put images into my PDF that are inside a private directory without needing to expose them.
$mime_type = mime_content_type($file_path);
$image_data = base64_encode(file_get_contents($file_path));
$data_uri = "data: $mime_type;base64,$image_data";
When I try using $data_uri as an img src, it throws a blank error with no message.
wait, what ??? but why you just do not put the $file_path into the src of the image tag ? look at examples, i never put url in the src of the images, i put path... using the "data:" is totally useless