Performance help for loading large images

I have a problem.

Here’s the background.
I’m trying to create a photo album app for click and dragging a
selection of images into a virtual photo album. There are about 50
photos in a directory and thanks to the help from you guys on the SDL
List I can go through them all and load each photo etc.

I’m trying to implement a neat 3d feature where you can spin the images
around in a circle and then click drag the selected/front most image to
where you want. Picture it as 6 texture squares layed out equal distance
around the circumpherence of a circle (in 3d). The problem is that with
all the images being between 100kb -300kb in size the entire app grinds
to a halt when I use IMG_Load and gluBuild2DMipmaps to load a group of 6
images at a time.

The problem is all the images are of arbitrary width and height so I’ve
concluded I need to use gluBuild2DMipmaps.
Also it is not practical to reduce the file sizes of the photos.

I’m pretty gutted becuase it took me a long time to get this far.

I’m basically asking anyone if they have any hints on how to load these
images quickly?

The code I’m using look like this:

void PhotoSelector::loadIMG(PhotoObject& targetPhotoObject, char* fileName)
{
SDL_Surface *photo; //Used for getting pixel data for the texture

//Begin creating the texture
if( (photo = IMG_Load(fileName)) )
{
    targetPhotoObject.w = (float)photo->w;
    targetPhotoObject.h = (float)photo->h;

    //Create the texture
    glGenTextures(1, &targetPhotoObject.id);

    //Load the texture
    glBindTexture(GL_TEXTURE_2D, targetPhotoObject.id);

    //Use nearest filtering
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 

GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    //Build the texture mipmaps
    //must use GL_BGR to get the colours right
    gluBuild2DMipmaps( GL_TEXTURE_2D, 3, photo->w, photo->h, GL_BGR, 

GL_UNSIGNED_BYTE, photo->pixels);
}
else
exit(1);

//free the temp surface if it was used
if(photo)
    SDL_FreeSurface(photo);

}

The six images I need at a time loaded into the structure

typedef struct{
GLuint id;
float w, h; //width, height
} PhotoObject;

Cheers to anyone keen enough.

Glenn