function getThumbnail($relative)
{
$fullpath = Files::makeFile($this->getBaseDir(), $relative);
//not a file???
if (!is_file($fullpath)) {
return $this->getDefaultThumb();
}
$imgInfo = @getImageSize($fullpath);
//not an image
if (!is_array($imgInfo)) {
return $this->getDefaultThumb();
}
//the original image is smaller than thumbnails,
//so just return the url to the original image.
if ($imgInfo[0] <= $this->config['thumbnail_width'] && $imgInfo[1] <= $this->config['thumbnail_height']) {
return $this->getFileURL($relative);
}
$thumbnail = $this->getThumbName($fullpath);
//check for thumbnails, if exists and
// it is up-to-date, return the thumbnail url
if (is_file($thumbnail)) {
if (filemtime($thumbnail) >= filemtime($fullpath)) {
return $this->getThumbURL($relative);
}
}
//well, no thumbnail was found, so ask the thumbs.php
//to generate the thumbnail on the fly.
return 'thumbs.php?img=' . rawurlencode($relative);
}