Hmm... I would think its kind of messy if you go the DB route. Not saying it can't be done, but it might be easier to query the records and use PHP to test (either via if or switch statements) for which images to display.
If the DB route was still the way to go, you'd need a way to associate legend images back to one record. You know you'll end up with duplicate rows with each unique legend image needed per record. If you can't deal with this, then you'll probably want to just resort to going with PHP code. If you can deal with this, then I might recommend using a binary value for the legend column. Here's how it might work:
1 = rejected
2 = edit
4 = active
8 = expired
16 = pending
The numeric values could be the IDs in your image lookup table.
The math:
Since I don't fully understand your system, I'm just going to toss out an example. If I'm lucky, it will sort of apply to what you're doing.
You take and add up the values of all the legend items you want "on" or displayed. Lets take "edit" and "active" for example. Edit is 2 and active is 4. So 2 + 4 = 6.
Now you have those IDs in the image lookup table. You could query those with a where clause like this: "... WHERE ID & 6" The & will do a bitwise AND compare and return ID 2 and 4.
But the trick is the value is different for each record you have in your master table. So for the legend field, you store the value 6. Then you could do this for your where clause: "... WHERE imagelookupID & legend"
Again, you'll get duplicate records because each row will represent one image.
Now subselects would be the way to go (or even better: a stored procedure). I'm assuming you're using MySQL and subselects are not an option.
Personally, I'd probably opt towards pulling the image values out of the DB once at the start of the page execution. Then pull the legend value out. Then use the binary trick I gave and use PHP to determine which image to plop down. But its your project, not mine.