I'm sure there are plenty of gallery scripts in the code libraries of sites like this one and Zend and hotscripts.com. The idea's simple. Store the original image somewhere, read it in, resize it, and save the result out somewhere else. Use a database to relate resized images with real images, and do <a><img></a> with the <a>'s href being the URL to the original image and the <img>'s src being the URL to the resized image.
Popups aren't that much more complicated; an onClick() handler that creates the popup window, with either the URL of the original image, or the URL to a PHP script (passing the image's ID in the URL's querystring) and have the script write HTML, including the <img> tag that will point to the original image.
When working out how to do the display right, mock it up with some static images and pages, get it looking right and the Javascript working, and then you'll know what your PHP script will need to generate.
After that the rest is gravy.