$aspect_y) { $thumb_width = $max_width; $thumb_height = $image_height / $aspect_x; } else { $thumb_height = $max_height; $thumb_width = $image_width / $aspect_y; } } $thumb = imagecreatetruecolor($thumb_width, $thumb_height); imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, imagesx($image), imagesy($image)); imagedestroy($image); if (!is_dir(DATA_ROOT . $dirname . "/" . $image_dir)) { mkdir(DATA_ROOT . $dirname . "/" . $image_dir, 0777, TRUE); } if (!$preview) { if (!is_dir(DATA_ROOT . "info/" . $image_dir)) { mkdir(DATA_ROOT . "info/" . $image_dir, 0777, TRUE); } $fp = fopen(DATA_ROOT . "info/" . $image_dir . $image_file . ".sfpg", "w"); fwrite($fp, date(DATE_FORMAT, filemtime(GALLERY_ROOT . $image_dir . $image_file)) . "|" . number_format(filesize(GALLERY_ROOT . $image_dir . $image_file), 0, '', '.') . "|" . $image_width . "|" . $image_height); fclose($fp); } header("Content-type: image/" . $thumb_type); header("Content-Disposition: inline; filename=\"" . $dirname . "_" . $image_file . "\""); if ($img_type == "jpeg") { imagejpeg($thumb, NULL, $jpeg_quality); imagejpeg($thumb, $thumb_file, $jpeg_quality); } elseif ($img_type == "png") { imagepng($thumb); imagepng($thumb, $thumb_file); } elseif ($img_type == "gif") { imagegif($thumb); imagegif($thumb, $thumb_file); } imagedestroy($thumb); } } function sfpg_dir_info($directory, $initial=TRUE) { list($dirs, $images, $files) = sfpg_get_dir($directory); if ($initial) { $info = count($dirs) . "|" . count($images) . "|" . count($files) . "|" . date(DATE_FORMAT, filemtime(GALLERY_ROOT . GALLERY . ".")) . "|"; } else { $info = ""; } if ((DIR_IMAGE_FILE) and file_exists(GALLERY_ROOT . $directory . DIR_IMAGE_FILE)) { return $info . sfpg_url_string($directory, DIR_IMAGE_FILE); } if (isset($images[0])) { return $info . sfpg_url_string($directory, $images[0]); } else { foreach ($dirs as $subdir) { $subresult = sfpg_dir_info($directory . $subdir . "/", FALSE); if ($subresult != "") { return $info . $subresult; } } } return $info; } function sfpg_set_dir_info($directory) { if (!is_dir(DATA_ROOT . "info/" . $directory)) { mkdir(DATA_ROOT . "info/" . $directory, 0777, TRUE); } if ($fp = fopen(DATA_ROOT . "info/" . $directory . "_info.sfpg", "w")) { fwrite($fp, sfpg_dir_info($directory)); fclose($fp); } } function sfpg_javascript() { global $dirs, $images, $files; echo ""; } $get_set = FALSE; if (isset($_GET["sfpg"])) { $get = explode("*", sfpg_base64url_decode($_GET["sfpg"])); if ((md5($get[0] . "*" . $get[1] . "*" . SECURITY_PHRASE) === $get[2]) and (strpos($get[0] . $get[1], "..") === FALSE)) { define("GALLERY", $get[0]); define("IMAGE", $get[1]); $get_set = TRUE; } } if (!$get_set) { define("GALLERY", ""); define("IMAGE", ""); } if (isset($_GET["cmd"])) { if ($_GET["cmd"] == "css") { header("Content-type: text/css"); echo " img { -ms-interpolation-mode : bicubic; } body.sfpg { background : $color_body_back; color: $color_body_text; font-family: Arial, Helvetica, sans-serif; font-size: ".FONT_SIZE."px; font-weight: normal; margin:0px; padding:0px; overflow:hidden; } body.sfpg a:active, body.sfpg a:link, body.sfpg a:visited, body.sfpg a:focus { color : $color_body_link; text-decoration : none; } body.sfpg a:hover { color : $color_body_hover; text-decoration : none; } table { font-size: ".FONT_SIZE."px; height:100%; width:100%; } table.info td { padding : 10px; vertical-align : top; } table.sfpg_disp { text-align : center; padding : 0px; } table.sfpg_disp td.menu { background : #000000; border-top : 1px solid #303030; vertical-align : middle; white-space: nowrap; } table.sfpg_disp td.navi { height: ".NAV_BAR_HEIGHT."px; background : #202020; border-top : 1px solid #303030; vertical-align : middle; white-space: nowrap; } table.sfpg_disp td.mid { vertical-align : middle; } .sfpg_info_text, .loading { background : #101010; border : 1px solid #101010; border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; -khtml-border-radius:4px; color : #aaaaaa; padding : 1px 4px 1px 4px; width : 200px; } .loading { padding : 20px 20px 20px 20px; margin-right: auto; margin-left: auto; border : 1px solid #202020 !important; } .sfpg_button, .sfpg_button_hover, .sfpg_button_on, .sfpg_button_nav, .sfpg_button_disabled { cursor : pointer; background : $color_button_back; border : 1px solid $color_button_border; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px; -khtml-border-radius:5px; color : $color_button_text; padding : 0px 5px 0px 5px; margin : 0px 5px 0px 5px; white-space: nowrap; } .sfpg_button_hover { background : $color_button_hover; color : $color_button_hover_text; } .sfpg_button_on { background : $color_button_on; color : $color_button_text_on; } .sfpg_button_disabled { cursor : default; border : 1px solid $color_button_border_off; border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; -khtml-border-radius:4px; background : $color_button_back_off; color : $color_button_text_off; } .sfpg_button_nav { border : 1px solid transparent; border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; -khtml-border-radius:4px; background:#202020; color:#808080; } .thumbbox { vertical-align : top; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; width: " . ((2 * (THUMB_BORDER_WIDTH + THUMB_MARGIN + THUMB_BOX_MARGIN)) + THUMB_MAX_WIDTH + 2) . "px; height: " . ((2 * (THUMB_BORDER_WIDTH + THUMB_MARGIN + THUMB_BOX_MARGIN)) + THUMB_MAX_HEIGHT + 2 + THUMB_BOX_EXTRA_HEIGHT) . "px; margin: 0px; padding: 0px; } .thumbimgbox { width: " . ((2 * (THUMB_BORDER_WIDTH + THUMB_MARGIN)) + THUMB_MAX_WIDTH) . "px; height: " . ((THUMB_BORDER_WIDTH * 2) + THUMB_MARGIN + THUMB_MAX_HEIGHT + 6) . "px; margin: 0px; padding: 0px; } .innerboxdir, .innerboximg, .innerboxfile, .innerboxdir_hover, .innerboximg_hover, .innerboxfile_hover { cursor:pointer; margin: " . THUMB_BOX_MARGIN . "px; padding: 0px; width: " . ((2 * (THUMB_BORDER_WIDTH + THUMB_MARGIN)) + THUMB_MAX_WIDTH + 2) . "px; height: " . ((2 * (THUMB_BORDER_WIDTH + THUMB_MARGIN)) + THUMB_MAX_HEIGHT + 2 + THUMB_BOX_EXTRA_HEIGHT) . "px; } .innerboxdir, .innerboxdir_hover { border: 1px solid $color_dir_box_border; border-radius:9px; -moz-border-radius:9px; -webkit-border-radius:9px; -khtml-border-radius:9px; background : $color_dir_box_back; color : $color_dir_box_text; } .innerboximg, .innerboximg_hover { border: 1px solid $color_img_box_border; border-radius:9px; -moz-border-radius:9px; -webkit-border-radius:9px; -khtml-border-radius:9px; background : $color_img_box_back; color : $color_img_box_text; } .innerboxfile, .innerboxfile_hover { border: 1px solid $color_file_box_border; border-radius:9px; -moz-border-radius:9px; -webkit-border-radius:9px; -khtml-border-radius:9px; background : $color_file_box_back; color : $color_file_box_text; } .innerboxdir_hover { background : $color_dir_hover; color : $color_dir_hover_text; } .innerboximg_hover { background : $color_img_hover; color : $color_img_hover_text; } .innerboxfile_hover { background : $color_file_hover; color : $color_file_hover_text; } .full_image { cursor:pointer; border : ".FULLIMG_BORDER_WIDTH."px solid $color_fullimg_border; border-radius:9px; -moz-border-radius:9px; -webkit-border-radius:9px; -khtml-border-radius:9px; } .thumb { margin: " . THUMB_MARGIN . "px " . THUMB_MARGIN . "px 5px " . THUMB_MARGIN . "px; border : ".THUMB_BORDER_WIDTH."px solid $color_thumb_border; border-radius:9px; -moz-border-radius:9px; -webkit-border-radius:9px; -khtml-border-radius:9px; } .box_image { position:absolute; bottom:".MENU_BOX_HEIGHT."px; right:0; z-index:1020; overflow:auto; visibility:hidden; text-align : center; } .box_wait { position:absolute; bottom:".MENU_BOX_HEIGHT."px; right:0; z-index:1015; overflow:auto; visibility:hidden; text-align : center; } .box_navi { position:absolute; bottom:0; left:0; height:".MENU_BOX_HEIGHT."px; width:100%; z-index:1120; overflow:hidden; text-align : center; } .box_info { position:absolute; top:10px; left:10px; width:".INFO_BOX_WIDTH."px; z-index:1040; visibility:hidden; overflow:auto; border : 1px solid #101010; border-radius:9px; -moz-border-radius:9px; -webkit-border-radius:9px; -khtml-border-radius:9px; background: #101010; } .box_overlay { position:absolute; bottom:".MENU_BOX_HEIGHT."px; left:0; height:100%; width:100%; z-index:1010; overflow:hidden; visibility:hidden; background:$color_overlay; } .box_gallery { text-align:center; position:absolute; top:0; right:0; z-index:1000; overflow:auto; } "; exit; } if ($_GET["cmd"] == "thumb") { sfpg_thumb(GALLERY, IMAGE); exit; } if ($_GET["cmd"] == "preview") { if (USE_PREVIEW) { sfpg_thumb(GALLERY, IMAGE, TRUE); } exit; } if ($_GET["cmd"] == "file") { header("Location: " . GALLERY_ROOT . GALLERY . IMAGE); exit; } if (($_GET["cmd"] == "image") or (($_GET["cmd"] == "dl") and TEXT_DOWNLOAD)) { $image_file = GALLERY_ROOT . GALLERY . IMAGE; $img_type = sfpg_image_type($image_file); if (file_exists($image_file) and $img_type) { if ($_GET["cmd"] == "dl") { header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"" . IMAGE . "\""); } else { header("Content-Type: image/" . $img_type); header("Content-Disposition: inline; filename=\"" . IMAGE . "\""); } readfile($image_file); } exit; } } list($dirs, $images, $files) = sfpg_get_dir(GALLERY); echo "" . "" . "" . TEXT_GALLERY_NAME . ""; sfpg_javascript(); echo "" . "
" . "" . "" . "" . "
" . "
" . "
" . "
" . "
" . "
" . "
" . "" . "" . "
" . "\"\"" . "
" . "
" . "
" . "" . "" . "
" . "
" . "
" . "
" . "
" . "" . "" . "
" . "
" . "
" . "
" . "
" . "
" . ""; ?>