diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 02f5f221..a11c1620 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -387,7 +387,7 @@ class Image { * @retval string */ public function get_mime_type() { - return getMimeType($this->get_image_filename()); + return getMimeType($this->get_image_filename(), $this->get_ext()); } /** diff --git a/core/util.inc.php b/core/util.inc.php index ddb68b51..5d74163e 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -508,7 +508,7 @@ function captcha_check() { * @param string &$file File path * @return string */ -function getMimeType($file) { +function getMimeType($file, $ext="") { $type = false; // Fileinfo documentation says fileinfo_open() will use the // MAGIC env var for the magic file @@ -532,6 +532,7 @@ function getMimeType($file) { if ($type !== false && strlen($type) > 0) return $type; // Otherwise do it the old fashioned way + $ext = strtolower($ext); static $exts = array( 'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'ico' => 'image/x-icon', @@ -546,7 +547,6 @@ function getMimeType($file) { 'avi' => 'video/x-msvideo', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mov' => 'video/quicktime', 'flv' => 'video/x-flv', 'php' => 'text/x-php' ); - $ext = strtolower(pathInfo($file, PATHINFO_EXTENSION)); return isset($exts[$ext]) ? $exts[$ext] : 'application/octet-stream'; } diff --git a/ext/image/main.php b/ext/image/main.php index f4650626..be28faed 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -365,8 +365,6 @@ class ImageIO extends Extension { $file = $image->get_image_filename(); } - $page->set_data(file_get_contents($file)); - if(isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) { $if_modified_since = preg_replace('/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"]); } @@ -377,9 +375,11 @@ class ImageIO extends Extension { if($if_modified_since == $gmdate_mod) { $page->add_http_header("HTTP/1.0 304 Not Modified",3); + $page->set_data(""); } else { $page->add_http_header("Last-Modified: $gmdate_mod"); + $page->set_data(file_get_contents($file)); if ( $config->get_int("image_expires") ) { $expires = date(DATE_RFC1123, time() + $config->get_int("image_expires")); diff --git a/ext/mass_tagger/main.php b/ext/mass_tagger/main.php index 7170dae8..6b7a8132 100644 --- a/ext/mass_tagger/main.php +++ b/ext/mass_tagger/main.php @@ -1,7 +1,7 @@ + * Author: Christian Walde , contributions by Shish and Agasa * License: WTFPL * Description: Tag a bunch of images at once * Documentation: @@ -38,8 +38,18 @@ class MassTagger extends Extension { $images = array_map( "Image::by_id", $ids ); - foreach($images as $image) { - $image->set_tags($tag . " " . $image->get_tag_list()); + if(isset($_POST['setadd']) && + $_POST['setadd'] == 'set') + { + foreach($images as $image) { + $image->set_tags($tag); + } + } + else + { + foreach($images as $image) { + $image->set_tags($tag . " " . $image->get_tag_list()); + } } $page->set_mode("redirect"); diff --git a/ext/mass_tagger/theme.php b/ext/mass_tagger/theme.php index 0f0b009e..5a844bac 100644 --- a/ext/mass_tagger/theme.php +++ b/ext/mass_tagger/theme.php @@ -13,6 +13,7 @@ class MassTaggerTheme extends Themelet { Click on images to mark them. Use the 'Index Options' in the Board Config to increase the amount of shown images.
+ Set instead of add?