if(preg_match('/^[a-zA-Z0-9]+\.(gif|jpe?g)$/',$row['filename'],$matches) &&
is_readable($row['filepath'].$row['filename'])){
echo header('Content-Type: image/'.$matches[1]);
echo header('Content-Length: '.filesize($row['filepath'].$row['filename']));
echo file_get_contents($row['filepath'].$row['filename']);
} else {
echo 'cant serve image: '.$row['filename'];
}
When I try to place the header('Content-Type': image/jpeg)
for example, It only displays a blank page and the current url.
Im trying to display an image to replace my <img>
tags.
filepath contains the physical path for the directory of the image.