I wish to implement a tag system for a gallery,I have a huge number of images and all of them are to be associated with one or more tags. The number of tags is also large,but not exceeding say 500,isn't constant.Tag texts may also be large in certain cases. What is the best way to implement such a tag system performance-wise(out of the following or add yours)

1.Create a column for every tag in the images table,fill it with 0/1,requires manually changing the DB structure,everytime a new tag is added.
2.Have a single column named tags in the images table and fill it with a binary string like 100010 where 1 denotes availability and 0 denotes not,for tags in increasing order of tagids,will be costly for retrieving images with specific tags.

Thankyou for the response.
I actually thought of implementing a third table at some point of time,but discraded it due to reasons I can't remember now :P

I have implemented that method and all is well.
Thankyou again.
Marked as solved.