I am trying to echo an image after fopen and fread it, but it shows as ascii code not as image format.
I found an answer:
Fopen function opens JPEG image as text
I implemented the header() line in my code but it seems that it try to open my current php file as jpg not the image.
Here is my code:
        $filename = $n.".jpg";
        //echo $n.'.jpg'; prints image_name.jpg
        $fp = fopen($filename, "r");
        $data = fread($fp, filesize($filename));
        header('Content-type: image/jpg'); //without the header line I can print the ascii
        echo $data; //I want to print my $data as image format not ascii
        fclose($fp);
(I don't know if it does matter but I am using latest version of XAMPP and W7)
Thanks in advance
 
     
     
    