static function Thumbnail($image_file, $thumb_file, $width = 48, $height = 48)
{
$ctype = FSS_Helper::datei_mime("png");
// thumb file exists
if (file_exists($thumb_file) && filesize($thumb_file) > 0) {
header("Content-Type: " . $ctype);
header('Cache-control: max-age=' . 60 * 60 * 24 * 365);
header('Expires: ' . gmdate(DATE_RFC1123, time() + 60 * 60 * 24 * 365));
@readfile($thumb_file);
exit;
}
require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'third' . DS . 'simpleimage.php';
$im = new SimpleImage();
$im->load($image_file);
if (!$im->image) {
// return a blank thumbnail of some sort!
$im->load(JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'assets' . DS . 'images' . DS . 'blank_16.png');
}
$im->resize($width, $height);
$im->output();
$im_data = ob_get_clean();
if (strlen($im_data) > 0) {
// if so use JFile to write the thumbnail image
JFile::write($thumb_file, $im_data);
} else {
// it failed for some reason, try doing a direct write of the thumbnail
$im->save($thumb_file);
}
header('Cache-control: max-age=' . 60 * 60 * 24 * 365);
header('Expires: ' . gmdate(DATE_RFC1123, time() + 60 * 60 * 24 * 365));
header("Content-Type: " . $ctype);
if (file_exists($thumb_file && filesize($thumb_file) > 0)) {
@readfile($thumb_file);
} else {
$im->output();
}
exit;
}