suzzane2020 Posted November 6, 2008 Share Posted November 6, 2008 How do I read and output an image file using php. I have a function that get the image path and then uses fread to read the image file. This throws an error " supplied argument is not a valid stream resource" pointing to the fread I found out we need the header("Content-type: image/jpg") but not sure about the rest of the code. Could anyone plz help? thank you Link to comment https://forums.phpfreaks.com/topic/131600-reading-an-image-file-with-php-file-functions/ Share on other sites More sharing options...
ratcateme Posted November 6, 2008 Share Posted November 6, 2008 Try $file_name = "image.jpg"; header("Content-type: image/jpg") readfile($file_name); Scott. Link to comment https://forums.phpfreaks.com/topic/131600-reading-an-image-file-with-php-file-functions/#findComment-683490 Share on other sites More sharing options...
suzzane2020 Posted November 6, 2008 Author Share Posted November 6, 2008 thank you so much. It was this simple and I could not get a direct solution after so much googling. Thanx again! Link to comment https://forums.phpfreaks.com/topic/131600-reading-an-image-file-with-php-file-functions/#findComment-683497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.