To get the "dot" part of this funtion working, one needs to change the following line from:
$dot = $include_dot ? $dot.'' : '';
to:
$dot = $include_dot ? $dot.'.' : '';
I also recommend to change the following line from:
function image_type_to_extension($imagetype,$include_dot=true)
to:
function image_type_to_extension($imagetype,$include_dot=false)
(This so that one gets a result without the dot by default, witch is nice when one needs to compair it later on)...
getimagesize