According to their docs you only need 3 images, and you'd probably do well to only keep the address of one image in your database.
eg
Code:
dogs_table
=========
id | dog_name | image
----------------------
2 | bozo | /dogs/bozo.jpg
Then on your file system have 3 images you create elsewhere, but always adhere to a strict naming convention:
/images/dogs/bozo.jpg
/images/dogs/bozo-medium.jpg
/images/dogs/bozo-large.jpg
(with that naming convention you could even get away with not storing the image name)
Then it will be quite easy to generate the necessary matching code that cloud zoom requires. Use PHP to output the necessary vars into each loop.
Code:
<a href='/images/dogs/bozo-large.jpg' class='cloud-zoom-gallery' title='Bozo'
rel="useZoom: 'zoom1', smallImage: '/images/dogs/bozo.jpg' ">
<img src="/images/dogs/bozo-medium.jpg" alt = "Bozo"/></a>
You could also use the id number alone as the identifier as they show in their demo code.
Code:
<a href='/images/zoomengine/bigimage00.jpg' class='cloud-zoom-gallery' title='Thumbnail 1'
rel="useZoom: 'zoom1', smallImage: '/images/zoomengine/smallimage.jpg' ">
<img src="/images/zoomengine/tinyimage.jpg" alt = "Thumbnail 1"/></a>
<a href='/images/zoomengine/bigimage01.jpg' class='cloud-zoom-gallery' title='Thumbnail 2'
rel="useZoom: 'zoom1', smallImage: ' /images/zoomengine/smallimage-1.jpg'">
<img src="/images/zoomengine/tinyimage-1.jpg" alt = "Thumbnail 2"/></a>
<a href='/images/zoomengine/bigimage02.jpg' class='cloud-zoom-gallery' title='Thumbnail 3'
rel="useZoom: 'zoom1', smallImage: '/images/zoomengine/smallimage-2.jpg' ">
<img src="/images/zoomengine/tinyimage-2.jpg" alt = "Thumbnail 3"/></a>
You may have other reasons to store 4 image paths in your database table, but setting up a naming convention and following it would probably be enough to use this jQuery code.
Bookmarks