$src_w) { $new_h = $single_extent - $spacing; $new_w = floor(($src_w / $src_h) * $new_h); } else { $new_w = $single_extent - $spacing; $new_h = floor(($src_h / $src_w) * $new_w); } $row = floor($i / $config['design']['folderthumbs'] + 0.000001); $col = $i % $config['design']['folderthumbs']; $dest_x = $startx + ($single_extent - $new_w) / 2 + $col * $single_extent; $dest_y = $starty + ($single_extent - $new_h) / 2 + $row * $single_extent; $src_img = ImageCreateFromJPEG($source . $images[$i]); pwa_imagecopy($config['images']['folderthumbs'], $dst_img, $src_img , $dest_x, $dest_y, 0, 0, $new_w, $new_h, $src_w, $src_h); ImageDestroy($src_img); } } $dir_count = count($directories); if ($dir_count > 0) { $black = imagecolorallocate ($dst_img, 0, 0, 0); $dir_count_len = strlen("$dir_count"); $str_width = imagefontwidth(3) * $dir_count_len; $str_height = imagefontheight(3); $startx = 13.5 / 15.0 * $dst_size - $str_width; $starty = 13.5 / 15.0 * $dst_size - $str_height; // copy empty folder.jpg $img_data=getimagesize($config['dir']['self'] . '/images/folder.jpg'); $src_w=$img_data[0]; $src_h=$img_data[1]; $src_img = ImageCreateFromJPEG($config['dir']['self'] . '/images/folder.jpg'); pwa_imagecopy($config['images']['folderthumbs'], $dst_img, $src_img , $startx - 5, $starty - 5, 0, 0, $str_width + 10, $str_height + 10, $src_w, $src_h); ImageDestroy($src_img); imagestring($dst_img, 3, $startx, $starty, "$dir_count", $black); } } imageJPEG($dst_img, $destination); ImageDestroy($dst_img); } } function create_forbidden_thumb($destination) { global $config; if ($config['images']['folderthumbs'] == 'external') { pwa_externalresize($config['dir']['self'] . '/images/forbidden.jpg', $destination, $config['design']['thumbsize']); } else { $dst_img = pwa_imagecreate($config['images']['folderthumbs'], $config['design']['thumbsize'], $config['design']['thumbsize']); $src_img = ImageCreateFromJPEG($config['dir']['self'] . '/images/forbidden.jpg'); pwa_imagecopy($config['images']['folderthumbs'], $dst_img, $src_img , 0, 0, 0, 0, $config['design']['thumbsize'], $config['design']['thumbsize'], 150, 150); imagejpeg($dst_img, $destination); imagedestroy($src_img); imagedestroy($dst_img); } } require('./start.inc.php'); $path = url_path(base64_decode($_GET["path"])); header('Content-type: image/jpeg'); clearstatcache(); $permissions = get_permissions($path['rel']); if (!$permissions['view']) { $forbidden = tmp_file(urn_thumb('/images/forbidden.jpg')); if (!file_exists($forbidden)) { create_forbidden_thumb($forbidden); } $file = fopen($forbidden, 'rb'); fpassthru($file); fclose($file); } else { if (!file_exists($path['thumb']) || filemtime($path['abs']) > filemtime($path['thumb'])) { create_thumb($path['abs'], $path['thumb'], $config['design']['thumbsize']); } $file = fopen($path['thumb'], 'rb'); fpassthru($file); fclose($file); } ?>