Fread( doesnt seem to return data in PHP


$r = fopen("images/nowplaying.png", 'r');
if ($r !== false) 
    $textXML = fread($r,filesize("images/nowplaying.png"));
} else {
    ReturnError(500, 'Failed to write artwork to a file.');   

it seems to only read one image here “images/nowplaying_artwork_2.png” why is this different chmods are the same ?

If you need help, you need to write more clearly.
Please fill up according to template

KangJL it didnt have one ?

The template should come up when you create a new topic. Strange…

idk it does one image but not other if the images chmods are the same and the are in same location should they not do same thing ?

I see this

Good luck!

I see this


Is the file corrupted?

This looks ok



The code you’re using only reads the image from images/nowplaying.png, not images/nowplaying_artwork_2.png? Of course, if you’re writing something to file A, then it doesn’t update file B. Or did you edit/simplify the code sample for this question?

Also, I would personally just use file_get_contents("images/nowplaying.png") so you don’t have to deal with the tape drive style API of fopen, but this should be fine too.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.