I'm using this code to output a file on uuser web browser.
header("Content-Type: image/png");
header("Content-Disposition: inline; filename=".$file_name.".png;");
echo file_get_contents('data:image/png;base64,'. $file_content);
This works fine in my localhost docker environment, but in EC2 it shows weird chars (like picture below).
Am I doing something wrong?
My Answer:
"Content-type: image/png");
readfile("path/to/image.png");
Rate this post
5 of 5 based on 5526 votesComments