[nycphp-talk] Determining mime type of data not a file
Scott Mattocks
scott at crisscott.com
Wed Jan 25 10:18:09 EST 2006
Hello,
I am looking for a way to determine the mime type of an image that is
held in memory and does not come from a file. All of the functions I can
find only work on files. Does anyone know of a way to get the mime type
from the image data? Here is a basic idea of what is happening:
function spitOutImage($imageToGet)
{
if (cache::isCached($imageToGet)) {
$image = cache::getImage($imageToGet);
} else {
$image = $this->createImage($imageToGet);
}
header('Content-type: ???');
echo $image;
}
If createImage() is called, I can get the image type, but if the image
is cached, I can't. The cached image just lives as data somewhere with
no other information.
Thanks,
--
Scott Mattocks
http://www.crisscott.com
More information about the talk
mailing list