John Davidson

laravel - php - show png/image in browser works in localhost but not on aws

0 comments
Message:


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 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us