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?
Try doing it like this:
<img src='data:image/png;base64,<?php echo base64_encode(file_get_contents($file_name.".png")); ?>'>
1.4m articles
1.4m replys
5 comments
57.0k users