[eluser]Phil Sturgeon[/eluser]
I was going to write in a switch for that but decided it would take 1 minute too long. Storing the content type is always a good idea with images. :-)
Don't just save the extension either cause the variations can cause complications through your code. When you save it use a switch like:
Code:
switch($ext) {
case 'jpg':
case 'jpe':
case 'jpeg':
$type = 'jpeg';
break;
case 'xbmp':
$type = 'bmp';
break;
case 'png':
case 'gif':
$type = $ext;
break;
}
Etc. You can also add a default in there to use whatever $ext is, or fail with an error/validation message.