Get images

I would like to build a gallery using jquery from scratch in the code, rather than a plugin, that pulls images from the media library. This way my clients can just drop in their images and they will appear. But I dont know the php for this that says generate image in this spot. Also how do I let wordpress know that this is an image for the gallery rather than just an image for another spot?