function tfu_info($file)
{
    global $use_image_magic;
    unset($_SESSION['TFU_LAST_UPLOADS']);
    $_SESSION['TFU_LAST_PREVIEW'] = fixUrl(getRootUrl() . $file);
    echo '&size=' . filesize($file);
    // we check if the image can be resized
    if (is_supported_tfu_image($file)) {
        set_error_handler('on_error_no_output');
        // is needed because error are most likly but we don't care about fields we don't even know
        $oldsize = @getimagesize($file);
        set_error_handler('on_error');
        if ($oldsize) {
            if (isMemoryOk($oldsize, "")) {
                echo '&hasPreview=true&tfu_x=' . $oldsize[0] . '&tfu_y=' . $oldsize[1];
                // has preview!
            } else {
                echo '&hasPreview=error';
                // too big! - same error massage as hasPreview=false
            }
            return;
        }
        echo '&hasPreview=false';
        // no image!
    }
    if (preg_match("/.*\\.(p|P)(d|D)(f|F)\$/", $file) && $use_image_magic && file_exists(dirname(__FILE__) . '/thumbs') && is_writable(dirname(__FILE__) . '/thumbs')) {
        // check if pdf
        echo '&hasPreview=true&tfu_x=1000&tfu_y=1000';
        // has preview! - pdfs are max 1000x1000';
        return;
    }
    echo '&hasPreview=false';
}
示例#2
0
     $size = 100000;
     // no resize
 }
 $remaining = -1 + $_GET['remaining'];
 if ($remaining < 0) {
     // not valid! ew expect at least 1
     return;
 }
 if (!isset($_SESSION["TFU_LAST_UPLOADS"]) || isset($_GET['firstStart'])) {
     // we delete the info of the last upload items!
     unset($_SESSION["TFU_LAST_UPLOADS"]);
     $_SESSION["TFU_LAST_UPLOADS"] = array();
 }
 foreach ($_FILES as $fieldName => $file) {
     $store = true;
     if (is_supported_tfu_image($file['name']) && $size < 100000) {
         $store = resize_file($file['tmp_name'], $size, 80, $file['name']);
     }
     if ($store) {
         if ($fix_utf8 == "") {
             $image = utf8_decode(str_replace("\\'", "'", $file['name']));
             // fix for special characters like öäüÖÄÜñé...
         } else {
             $image = str_replace("\\'", "'", iconv("UTF-8", $fix_utf8, $file['name']));
         }
         $filename = $dir . "/" . $image;
         $uploaded = false;
         if (@move_uploaded_file($file['tmp_name'], $filename)) {
             if (file_exists($filename)) {
                 $uploaded = true;
             }
示例#3
0
         } else {
             send_thumb($file, 90, 80, 55);
             // small preview
         }
     } else {
         return;
         // we return nothing if no image.
     }
 } else {
     if ($action == "info") {
         // get infos about a file
         unset($_SESSION["TFU_LAST_UPLOADS"]);
         $_SESSION["TFU_LAST_PREVIEW"] = fixUrl(getRootUrl() . $file);
         echo "&size=" . filesize($file);
         // we check if the image can be resized
         if (is_supported_tfu_image($file)) {
             set_error_handler("on_error_no_output");
             // is needed because error are most likly but we don't care about fields we don't even know
             $oldsize = @getimagesize($file);
             set_error_handler("on_error");
             if ($oldsize) {
                 if (isMemoryOk($oldsize, "")) {
                     echo "&hasPreview=true&tfu_x=" . $oldsize[0] . "&tfu_y=" . $oldsize[1];
                     // has preview!
                 } else {
                     echo "&hasPreview=error";
                     // too big! - same error massage as hasPreview=false
                 }
                 return;
             }
             echo "&hasPreview=false";