Эта концепция в некоторой степени похожа на приведенный ниже код, где img1.jpg
- это файл изображения
$handle = fopen('img1.jpg', 'r');
header("Content-type: image/gif");//make sure that you dont have output before it
echo fread($handle, filesize('img1.jpg'));
И попробуйте следующий эксперимент
$handle = fopen('img1.jpg', 'r');
echo fread($handle, filesize('img1.jpg'));
//If you are storing the output of this in
//your db then this should work
//however it is best recommended to store
//path which makes you jog a lot easir
//if you get the same error then you have error in
//storing your file