tmpfile() does not return the name of the file it created.
To get access to the file, use something like this:
$tempfn = tempnam("","");
$temp = fopen($tempfn, "w");
fwrite($temp, $data);
fclose($temp);
//your functions here, ie:
$size=getimagesize($tempfn);
unlink($tempfn);
tempnam