Skip to content
Advertisement

Tag: mime-types

How can I detect the mime type with PHP when an actual file doesn’t exist?

Is there a way to detect the mime type of a file without actually having an actual file, for example when you’re generating the file and serving it as a download? I’m currently using file extension sniffing from here: http://www.php.net/manual/en/function.mime-content-type.php#87856 I was just wondering if there was another way short of actually creating the file on the server and using

Return a PHP page as an image

I am trying to read a image file (.jpeg to be exact), and ‘echo’ it back to the page output, but have is display an image… my index.php has an image link like this: and my php script does basically this: 1) read 1234.jpeg 2) echo file contents… 3) I have a feeling I need to return the output back

Advertisement