Merge branch 'master' of github.com:shish/shimmie2
This commit is contained in:
commit
e3d385aee5
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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';
|
||||
}
|
||||
|
||||
|
@ -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"));
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* Name: Mass Tagger
|
||||
* Author: Christian Walde <walde.christian@googlemail.com>
|
||||
* Author: Christian Walde <walde.christian@googlemail.com>, 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");
|
||||
|
@ -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.
|
||||
<br />
|
||||
<input type='hidden' name='ids' id='mass_tagger_ids' />
|
||||
Set instead of add? <input type='checkbox' name='setadd' value='set' />
|
||||
<label>Tags: <input type='text' name='tag' /></label>
|
||||
|
||||
<input type='submit' value='Tag Marked Images' />
|
||||
|
Loading…
x
Reference in New Issue
Block a user