I'm trying to find the mime type of an image. PHP has the function `getimagesize` but that only takes a filename, whereas I have an image "resource" instead - i.e. an image created from `imagecreatefromstring`.

I found the functions `imagesx` and `imagesy` which return the width/height from a resource but I can't find any function that tell me the mime type from a resource. Anyone know of a way to do this?

Note: Due to a weird server set up, we **can't read/write files** from the server normally, only through an FTP layer (which is where I read the image data from).