<p>I am looking for a way to take a user uploaded image that is currently put in a temporary location ex: /tmp/jkhjkh78 and create a php image from it, autodetecting the format.</p>

<p>Is there a more clever way to do this than a bunch of try/catching with imagefromjpeg, imagefrompng, etc?</p>

You can call a system command (if you're under linux/unix),
```
file
```
if you like:
```
```
kender@eira:~$ file a
a: JPEG image data, EXIF standard 2.2
```
```