Obviously, you have to create a PHP file that will generate thumbs for you. Let's call it "thumb.php". In this file you have to know somehow which thumb to generate. You can pass some id to the file (via GET) as the thumb identifier. This can be filename, for example.
Somewhere in your html source file you put something like this
Now, this is what your thumb.php might look like:
<img src="/thumb.php?id=thumb1" />
<img src="/thumb.php?id=thumb2" />
<!-- etc -->
Things to note
// Here you have to convert what's get passed in $_GET['id'] into file name
// Here is example implementation
$filename = '/my/full/path/to/original/thumbnails/'.$_GET['id'].'.jpeg';
// Now we call the resizing function
// In the example I used 80x80 thumbs
outputimage($filename, 80, 80);
list($width, $height) = getimagesize($filename);
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, null, 50);
1) The way you convert id to full path will definitely differ in your implementation. You have to think about it.
2) Note, that I added Content-Type header to the original function
Hope this helps.