Exemplo n.º 1
0
                $getthumb = false;
                break;
            }
            break;
        }
    } elseif ($thumbnails == 'permanent') {
        if ($extension == 'pdf' && function_exists('exec')) {
            $thumbpath = $rootpath . $dir . '/_thumb_' . $thumbfix . $rawname . '.jpg';
            $tempfile = fileaway_utility::urlesc($file);
            if (!is_file($thumbpath)) {
                $pdfpath = $rootpath . $dir . '/' . $file;
                //exec("convert \"{$pdfpath}[0]\" -colorspace RGB -geometry 60x40 $thumbpath");
                //exec("convert -define jpeg:size=120x60 \"{$pdfpath}[0]\" -colorspace RGB -geometry 120x60 $thumbpath");
                if ($thumbsize == 'large') {
                    exec("convert -define jpeg:size=180x180 \"{$pdfpath}[0]\" -colorspace RGB -thumbnail 180x180 -gravity center -crop 180x180+0+0 +repage {$thumbpath}");
                } elseif ($thumbsize == 'medium') {
                    exec("convert -define jpeg:size=120x120 \"{$pdfpath}[0]\" -colorspace RGB -thumbnail 120x120 -gravity center -crop 120x120+0+0 +repage {$thumbpath}");
                } else {
                    exec("convert -define jpeg:size=60x60 \"{$pdfpath}[0]\" -colorspace RGB -thumbnail 60x60 -gravity center -crop 60x60+0+0 +repage {$thumbpath}");
                }
            }
            $thumblink = is_file($thumbpath) ? str_replace($tempfile, '_thumb_' . $thumbfix . fileaway_utility::replacelast($tempfile, '.pdf', '.jpg'), $links[$k]) : false;
        } else {
            $tempfile = fileaway_utility::urlesc($file);
            if (!is_file($rootpath . $dir . '/_thumb_' . $thumbfix . $file)) {
                fileaway_utility::createthumb($rootpath . $dir . '/' . $file, $rootpath . $dir . '/_thumb_' . $thumbfix . $file, $extension, $thumbwidth, $thumbheight);
            }
            $thumblink = is_file($rootpath . $dir . '/_thumb_' . $thumbfix . $file) ? str_replace($tempfile, '_thumb_' . $thumbfix . $tempfile, $links[$k]) : false;
        }
    }
}