For the image tags it would be formatted like so:
[img src="path/to/file.jpg"]
the img_id of 7 corresponds to an image path like so:
<img alt="" src="path/to/file.jpg" />
Here's an example of before and after:
[b]Lorem ipsum dolor sit amet[/b], consectetuer adipiscing elit. Sed sapien felis, feugiat et, porta nec.
[i][b]Lorem ipsum dolor sit amet[/b], consectetuer[/i] adipiscing elit. Sed sapien felis, feugiat et, porta nec.
[img src="path/to/file.jpg"]
To:
<p><b>Lorem ipsum dolor sit amet</b>, consectetuer adipiscing elit. Sed sapien felis, feugiat et, porta nec.</p>
<p><i><b>Lorem ipsum dolor sit amet</b>, consectetuer</i> adipiscing elit. Sed sapien felis, feugiat et, porta nec.</p>
<img alt="" src="path/to/file.jpg" />
The guy won't know if I'm using someone else's code, so if you know of an already made bb code parser that would be great.