SELECT * FROM post, thread WHERE post.threadid=thread.threadid AND pagetext LIKE '%[img]%' AND thread.visible = 1