Beispiel #1
0
    error_gif('Извините, превью не сгенерировано администратором.');
}
$editor = new ImageEditor($file_local);
if (!$editor->ready) {
    error_gif('Не удалось открыть файл.');
}
if (!$w) {
    $editor->resizeToHeight($h);
} elseif (!$h) {
    $editor->resizeToWidth($w);
} else {
    $editor->resize($w, $h, $fitInside);
}
ob_start();
// Чтобы далее узнать точный размер файла
$editor->output();
header_img(2, ob_get_length(), time(), substr($file_name, 0, 20) . '.jpg');
ob_end_flush();
// Кэшируем
if ($LocalCache) {
    $editor->save($LocalCache . $file_name, IMAGETYPE_JPEG, $q);
}
exit;
// Показываем картинку с текстом ошибки
function error_gif($t)
{
    $vsize = 46;
    $t1 = substr($t, 0, 30);
    if ($t != $t1) {
        $t1 = ereg_replace(' [^ ]*$', '', $t1);
        $t2 = trim(substr($t, strlen($t1), 90));