Letting a user choose pictures

I have an area on a site where a user can upload pictures to, and then
another area in which they create a new topic. Now I want a user to be
able to select photos from their uploaded photos… and I’ve hit a
coder’s block. Any tips on designing this interface?

What’s exactly the question?

You have images, records with information about those images (path,
name…)
and all you need to do is show a list with this information.

Just get the image records as you would do with any other kind of
record.
Paginate if necessary and then display in a list or table.
(You may want to use thumbnails instead of fullsized images)
Main difference is that you have an additional image tag or link to
click the image for selecting it. (I would make that an Ajax response)

Then you action gets the images id (and user id or whatever)
and can assign it to any other subset or blogentry or whatever
you want to do with it.

Have a look at this site: www.nationalebeeldbank.nl

It’s doing something on that line, querying images with sphinx
and allow to add them to a cart or view the fullsize version.
(No need to create a user, searching images works without
registration)

A user can upload an arbitrary number of images to the site and then
there’s a section where they can create topics for forums of the site.
I would like the user to be able to select images from this list and
attach them to a topic and I’m not sure of how to design the UI for
that.