chris,
Let's try one thing at a time. See if you can output any image to the browser.
Drop this script somewhere, name it thumbnail.php, and call it from another page, like this:
<img src="thumbnail.php?src=somefile.jpg" />
This should create a thumbnail of your file. If this works, then you know that your client supports the method you are using (sending image headers and such). If this doesn't work, then you definitely have a problem with the client you are using, since I have tested this file in many browsers and it works.
<?php
$src = $_GET['src'];
// create and return a thumbnail version of a jpg image
// $src is passed in URL
// set up height and width of the created thmbnail
$newWidth = 200;
$newHeight = 200;
// read in the passed image
$im = imagecreatefromjpeg ("$src"); // Attempt to open
//obtain the original image Height and Width
$srcWidth = imagesx($im);
$srcHeight = imagesy($im);
// start by using width for calculations
$percentage = (double)$newWidth / $srcWidth;
$destHeight = round($srcHeight * $percentage) + 1;
$destWidth = round($srcWidth * $percentage) + 1;
if($destHeight > $newHeight){
// if the width produces a height bigger than we want,
// calculate based on height
$percentage = (double)$newHeight / $srcHeight;
$destHeight = round($srcHeight * $percentage) + 1;
$destWidth = round($srcWidth * $percentage) + 1;
}
// create a blank image of the required size
$new = imagecreatetruecolor ($destWidth, $destHeight);
// copy a resied version of the original to the new image
imagecopyresampled($new, $im, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
// output header and file
header ("content-type: image/jpeg");
imagejpeg ($new, '', 100);
// clear the image buffers
imagedestroy ($im);
imagedestroy ($new);
?>
If the image outputting part is not the problem, then you should check to see if the amount of data in you DB matches the amount of data in the file. This is probably the first thing you should do if you suspect that the uploading is getting screwed up.
Oh, by the way, if you are going to limit the uploaded fil with the HTML, bear this in mind (out of the PHP manual):
The MAX_FILE_SIZE is advisory to the browser. It is easy to circumvent this maximum. So don't count on it that the browser obeys your wish! The PHP-settings for maximum-size, however, cannot be fooled.
You probably knew that but it was worth mentioning.