One way could be to add a field in the table which can be 1 or 0 and is set when the post is made. If there is an image-tag in the post, the value of the field is set to 1. Then you would only have to check this variable in the postlist.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.