Thanks. I re-tested it.
OK, first of all. There is a small bug in the original script.
$src_img = imagecreatefromjpeg("$image_path/$image_name");
$new_w = $thumb_width;
$dst_img = imagecreate($new_w,$new_h);
it should be
Second, it does create the thumbnail. But the sample image I picked for jpg was small and too dark. The quality of the thumbnail is so poor. The thumbnail become just a black image (exactly). But I tested with some other images. It does create thumbnails but the quality is really poor.
Now my questions are:
Are there anyway to increase the quality of the thumbnails created by php image functions?
The thumbnails I created manually from photo shop. The size is 1/2, but the quality is 3 times better.
If php can only create these very poor quality but large size thumbnails, it doesn't help me very much. I may have to go back to the approach to create thumbnails offline manually.