If you've edited the image with image editing software and it no longer contains an exif thumbnail, I've created a script that will add one back into it, using the "PHP Exif Library": http://pel.sourceforge.net/index.php
<?php
require_once('../PEL/PelJpeg.php');
require_once('../PEL/PelIfd.php');
$fullpath = 'images/DSC_0013c.JPG'; # path of source image (does not contain an exif thumbnail)
$jpeg = new PelJpeg($fullpath);
$exif = $jpeg->getExif();
$tiff = $exif->getTiff();
$ifd0 = $tiff->getIfd(); # need this so that we can later link it to the new IFD
$ifd1 = $ifd0->getNextIfd();
if (!$ifd1) { # Only create thumbnail if one doesn't exist (i.e. there is no IFD1)
$ifd1 = new PelIfd(1);
$ifd0->setNextIfd($ifd1); # point ifd0 to the new ifd1 (or else ifd1 will not be read)
$original = ImageCreateFromString($jpeg->getBytes()); # create image resource of original
$orig_w=imagesx($original);
$orig_h=imagesy($original);
$wmax = 160;
$hmax = 120;
if ($orig_w>$wmax || $orig_h>$hmax) {
$thumb_w=$wmax;
$thumb_h=$hmax;
if ($thumb_w/$orig_w*$orig_h>$thumb_h)
$thumb_w=round($thumb_h*$orig_w/$orig_h); # maintain aspect ratio
else
$thumb_h=round($thumb_w*$orig_h/$orig_w);
}
else { # only set the thumb's size if the original is larger than 'wmax'x'hmax'
$thumb_w=$orig_w;
$thumb_h=$orig_h;
}
# create image resource with thumbnail sizing
$thumb=imagecreatetruecolor($thumb_w,$thumb_h);
## Resize original and copy to the blank thumb resource
imagecopyresampled($thumb,$original,
0,0,0,0,$thumb_w,$thumb_h,$orig_w,$orig_h);
# start writing output to buffer
ob_start();
# outputs thumb resource contents to buffer
ImageJpeg($thumb);
# create PelDataWindow from buffer thumb contents (and end output to buffer)
$window = new PelDataWindow(ob_get_clean());
if ($window) {
$ifd1->setThumbnail($window); # set window data as thumbnail in ifd1
$outpath = $fullpath; # overwrite original jpg file
file_put_contents($outpath, $jpeg->getBytes()); # write everything to output filename
# Show thumbnail in file:
echo '<img src="thumb_exif.php?image='.$outpath.'" border=0 alt="If you see this, it did not work"><br>';
}
}
else {
echo 'ifd1 already exists! (IFD1 is where the thumbnail is stored)<br>';
}
?>
<?php # This is the code in thumb_exif.php :
$imgdat = exif_thumbnail($_REQUEST['image'], $width, $height, $type);
header('Content-type: ' . image_type_to_mime_type($type));
echo($imgdat);
?>
If you have a lot of such files, you can easily make a script that searches them out and adds thumbnails to their exif.