Layerphp 0 Newbie Poster

Hi all,
I'm using igallery plugin for my website and when ever i upload images to gallery they will automatically be saved into incremental folders like...
if i upload 100 images they will be stored in "1-100" and if i again upload 100 images they will be stored in "101-200" folder and it continues....!
i'm able to save the image name and reference id in the database.
now my problem is how to know the image path with the image name or else with that image reference id i'e., the particular folder path of the image..any ideas..?
i'm using php and mysql.