* Site: http://www.imglib.endofinternet.net/ * This copyright notice MUST stay intact for use. * * This library gives you the possibility to upload, browse, manipulate and select * images on your webserver. * * Requirements: * - PHP 4.1.x or later ********************************************************************/ //sleep(1); // Require config and functions files require 'include' . DIRECTORY_SEPARATOR . 'config.php'; require 'include' . DIRECTORY_SEPARATOR . 'function.php'; // Create the upload dir if it not exist if (!file_exists($CFG->imgUploadDir)) { u_mkdir($CFG->imgUploadDir); } /* Temporary disable prevent access to thumbnail directory Waring in this mode for the uploaded pictures thumbnail not created so this mode ONLY FOR CLEAR or other jobs NOT FOR STANDART USE */ if (isset($_SERVER['HTTP_REFERER'])) { $ref_query = parse_url($_SERVER['HTTP_REFERER']); $ref_query = isset($ref_query['query']) ? $ref_query['query'] : ''; parse_str($ref_query, $ref_query); } /*-------------------------------- Show thumbail dir -----------------------------------------------*/ if (isset($_GET['showthumb']) && $_GET['showthumb'] == 1 || isset($ref_query['showthumb']) && $ref_query['showthumb'] == 1) { $CFG->thumbDirName = ''; $CFG->thumbAutoCreate = false; }
function create_file_thumb($path = '') { /* Create thumbnail for file $path - real path to file This function work with CLEAR path and files (check the path in outside the function) Return code true - Sucsess сreate false - Can`t сreate this thumbnail 4 - Create thumbnail not enabled in config 5 - Not File 11 - non-exist file or directory */ global $CFG; if (!empty($CFG->thumbDirName) && intval($CFG->thumbWidth) > 0 && intval($CFG->thumbHeight) > 0) { if (!file_exists($path)) { return 11; } $sc_type = is_file($path) ? 'file' : (is_dir($path) ? 'folder' : 'unknown'); if ($sc_type !== 'file') { return 5; } require_once 'img_function.php'; // Destination of thumbnail files $thumb_file = dirname($path) . DIRECTORY_SEPARATOR . $CFG->thumbDirName . DIRECTORY_SEPARATOR . basename($path); // Delete exist thumbnail file if (file_exists($thumb_file) && is_writable(dirname($thumb_file))) { unlink($thumb_file); } if (u_mkdir(dirname($path) . DIRECTORY_SEPARATOR . $CFG->thumbDirName . DIRECTORY_SEPARATOR) === true && create_thumb($path, $thumb_file, $CFG->thumbWidth, $CFG->thumbHeight, $CFG->thumbQuality) === true) { // Increase the time limit // set_time_limit(10); return true; } else { return false; } } return 4; }