Add option to simplify image filters

Default on (at least for the test), needs new language constants
This commit is contained in:
onli 2014-01-19 01:48:42 +01:00
parent 7a9d867fd1
commit 94f1198fe3
2 changed files with 54 additions and 34 deletions

@ -1959,47 +1959,61 @@ function serendipity_getimagesize($file, $ft_mime = '', $suf = '') {
function serendipity_getImageFields() {
global $serendipity;
$x = array(
'i.date' => array('desc' => SORT_ORDER_DATE,
'type' => 'date'
),
if ($serendipity['simpleImageFilters'] !== false) {
$x = array(
'i.date' => array('desc' => SORT_ORDER_DATE,
'type' => 'date'
),
'i.name' => array('desc' => SORT_ORDER_NAME
),
'i.extension' => array('desc' => SORT_ORDER_EXTENSION
),
'i.authorid' => array('desc' => AUTHOR,
'type' => 'authors'
),
);
'i.extension' => array('desc' => SORT_ORDER_EXTENSION
),
} else {
$x = array(
'i.date' => array('desc' => SORT_ORDER_DATE,
'type' => 'date'
),
'i.size' => array('desc' => SORT_ORDER_SIZE,
'type' => 'intrange'
),
'i.name' => array('desc' => SORT_ORDER_NAME
),
'i.dimensions_width' => array('desc' => SORT_ORDER_WIDTH,
'type' => 'intrange'
),
'i.authorid' => array('desc' => AUTHOR,
'type' => 'authors'
),
'i.dimensions_height' => array('desc' => SORT_ORDER_HEIGHT,
'type' => 'intrange'
)
);
'i.extension' => array('desc' => SORT_ORDER_EXTENSION
),
$addProp = explode(';', $serendipity['mediaProperties']);
foreach($addProp AS $prop) {
$parts = explode(':', $prop);
$name = $parts[0];
$x['bp.' . $name] = array('desc' => (defined('MEDIA_PROPERTY_' . $name) ? constant('MEDIA_PROPERTY_' . $name) : htmlspecialchars($name)));
if (preg_match('@date@i', $name)) {
$x['bp.' . $name]['type'] = 'date';
}
if (preg_match('@length@i', $name)) {
$x['bp.' . $name]['type'] = 'intrange';
}
if (preg_match('@dpi@i', $name)) {
$x['bp.' . $name]['type'] = 'int';
'i.size' => array('desc' => SORT_ORDER_SIZE,
'type' => 'intrange'
),
'i.dimensions_width' => array('desc' => SORT_ORDER_WIDTH,
'type' => 'intrange'
),
'i.dimensions_height' => array('desc' => SORT_ORDER_HEIGHT,
'type' => 'intrange'
)
);
$addProp = explode(';', $serendipity['mediaProperties']);
foreach($addProp AS $prop) {
$parts = explode(':', $prop);
$name = $parts[0];
$x['bp.' . $name] = array('desc' => (defined('MEDIA_PROPERTY_' . $name) ? constant('MEDIA_PROPERTY_' . $name) : htmlspecialchars($name)));
if (preg_match('@date@i', $name)) {
$x['bp.' . $name]['type'] = 'date';
}
if (preg_match('@length@i', $name)) {
$x['bp.' . $name]['type'] = 'intrange';
}
if (preg_match('@dpi@i', $name)) {
$x['bp.' . $name]['type'] = 'int';
}
}
}

@ -630,6 +630,12 @@
'type' => 'textarea',
'permission' => 'blogConfiguration',
'default' => ''),
array('var' => 'simpleImageFilters',
'title' => SIMPLE_IMAGE_FILTERS, // i18n
'description' => SIMPLE_IMAGE_FILTERS_DESC, // i18n
'type' => 'bool',
'permission' => 'blogConfiguration',
'default' => true),
));
return $res;