aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/image.class.php4
-rw-r--r--i.php22
-rw-r--r--include/derivative_std_params.inc.php20
-rw-r--r--picture.php2
-rw-r--r--themes/default/template/index.tpl12
-rw-r--r--themes/default/template/picture.tpl2
6 files changed, 27 insertions, 35 deletions
diff --git a/admin/include/image.class.php b/admin/include/image.class.php
index 1d1b70383..30e62de1d 100644
--- a/admin/include/image.class.php
+++ b/admin/include/image.class.php
@@ -265,8 +265,8 @@ class pwg_image
/** Returns a normalized convolution kernel for sharpening*/
static function get_sharpen_matrix($amount)
{
- // Amount should be in the range of 24-10
- $amount = round(abs(-24 + ($amount * 0.14)), 2);
+ // Amount should be in the range of 28-10
+ $amount = round(abs(-28 + ($amount * 0.18)), 2);
$matrix = array
(
diff --git a/i.php b/i.php
index ff4520e92..f59bf2aa9 100644
--- a/i.php
+++ b/i.php
@@ -28,6 +28,9 @@ include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/');
defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', $conf['data_location'].'i/');
+@include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php');
+
+
function trigger_action() {}
function get_extension( $filename )
{
@@ -372,10 +375,21 @@ foreach( explode(',','load,rotate,crop,scale,sharpen,watermark,save,send') as $k
$timing[$k] = '';
}
+include_once(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
include_once( PHPWG_ROOT_PATH .'/include/derivative_params.inc.php');
include_once( PHPWG_ROOT_PATH .'/include/derivative_std_params.inc.php');
-ImageStdParams::load_from_file();
+try
+{
+ $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'],
+ $conf['db_password'], $conf['db_base']);
+}
+catch (Exception $e)
+{
+ ilog("db error", $e->getMessage());
+}
+list($conf['derivatives']) = pwg_db_fetch_row(pwg_query('SELECT value FROM '.$prefixeTable.'config WHERE param=\'derivatives\''));
+ImageStdParams::load_from_db();
parse_request();
@@ -428,12 +442,8 @@ if (strpos($page['src_location'], '/pwg_representative/')===false
&& strpos($page['src_location'], 'themes/')===false
&& strpos($page['src_location'], 'plugins/')===false)
{
- @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php');
- include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
try
{
- $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'],
- $conf['db_password'], $conf['db_base']);
$query = 'SELECT coi, width, height FROM '.$prefixeTable.'images WHERE path=\''.$page['src_location'].'\'';
if ( ($row=pwg_db_fetch_assoc(pwg_query($query))) )
{
@@ -443,7 +453,6 @@ if (strpos($page['src_location'], '/pwg_representative/')===false
}
$page['coi'] = $row['coi'];
}
- mysql_close($pwg_db_link);
if (!$row)
{
ierror('Db file path not found', 404);
@@ -454,6 +463,7 @@ if (strpos($page['src_location'], '/pwg_representative/')===false
ilog("db error", $e->getMessage());
}
}
+mysql_close($pwg_db_link);
try_switch_source($params, $src_mtime);
diff --git a/include/derivative_std_params.inc.php b/include/derivative_std_params.inc.php
index c04daaf1f..06365e822 100644
--- a/include/derivative_std_params.inc.php
+++ b/include/derivative_std_params.inc.php
@@ -117,25 +117,6 @@ final class ImageStdParams
self::build_maps();
}
- static function load_from_file()
- {
- global $conf;
- $arr = @unserialize(@file_get_contents(PHPWG_ROOT_PATH.$conf['data_location'].'derivatives.dat'));
- if (false!==$arr)
- {
- self::$type_map = $arr['d'];
- self::$watermark = @$arr['w'];
- if (!self::$watermark) self::$watermark = new WatermarkParams();
- self::$custom = @$arr['c'];
- if (!self::$custom) self::$custom = array();
- }
- else
- {
- self::make_default();
- }
- self::build_maps();
- }
-
static function set_watermark($watermark)
{
self::$watermark = $watermark;
@@ -158,7 +139,6 @@ final class ImageStdParams
'c' => self::$custom,
) );
conf_update_param('derivatives', addslashes($ser) );
- file_put_contents(PHPWG_ROOT_PATH.$conf['data_location'].'derivatives.dat', $ser);
}
private static function make_default()
diff --git a/picture.php b/picture.php
index 6763ee881..bb5c79cab 100644
--- a/picture.php
+++ b/picture.php
@@ -172,6 +172,8 @@ function default_picture_content($content, $element_info)
{
if ($type==IMG_SQUARE || $type==IMG_THUMB)
continue;
+ if (!array_key_exists($type, ImageStdParams::get_defined_type_map()))
+ continue;
$url = $derivative->get_url();
if (isset($added[$url]))
continue;
diff --git a/themes/default/template/index.tpl b/themes/default/template/index.tpl
index c1f9d42a9..a78281aa5 100644
--- a/themes/default/template/index.tpl
+++ b/themes/default/template/index.tpl
@@ -7,7 +7,7 @@
<li>{strip}<a href="javascript:toggleSortOrderBox()" id="sortOrderLink" title="{'Sort order'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
<span class="pwg-icon pwg-icon-sort">&nbsp;</span><span class="pwg-button-text">{'Sort order'|@translate}</span>
</a>
- <div id="sortOrderBox" class="switchBox" style="display:none; text-align:left" onclick="toggleSortOrderBox()" onmouseout="e=event.toElement||event.relatedTarget;e.parentNode==this||e==this||toggleSortOrderBox()">
+ <div id="sortOrderBox" class="switchBox" style="display:none; text-align:left" onclick="toggleSortOrderBox()" onmouseout="e=event.toElement||event.relatedTarget;e.parentNode==this||e==this||toggleSortOrderBox(1)">
<div class="switchBoxTitle">{'Sort order'|@translate}</div>
{foreach from=$image_orders item=image_order name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
{if $image_order.SELECTED}
@@ -18,10 +18,10 @@
{/foreach}
</div>
{footer_script}{literal}
-function toggleSortOrderBox() {
+function toggleSortOrderBox(forceHide) {
var elt = document.getElementById("sortOrderBox"),
ePos = document.getElementById("sortOrderLink");
- if (elt.style.display==="none") {
+ if (!forceHide && elt.style.display==="none") {
elt.style.position = "absolute";
elt.style.left = ePos.offsetLeft+"px";
elt.style.top = (ePos.offsetTop+ePos.offsetHeight)+"px";
@@ -38,7 +38,7 @@ function toggleSortOrderBox() {
<li>{strip}<a href="javascript:toggleImageDerivativesBox()" id="derivativeChooseLink" title="{'Photo sizes'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
<span class="pwg-icon pwg-icon-sizes">&nbsp;</span><span class="pwg-button-text">{'Photo sizes'|@translate}</span>
</a>
- <div id="derivativeSwitchBox" class="switchBox" style="display:none; text-align:left" onclick="toggleImageDerivativesBox()" onmouseout="e=event.toElement||event.relatedTarget;e.parentNode==this||e==this||toggleImageDerivativesBox()">
+ <div id="derivativeSwitchBox" class="switchBox" style="display:none; text-align:left" onclick="toggleImageDerivativesBox()" onmouseout="e=event.toElement||event.relatedTarget;e.parentNode==this||e==this||toggleImageDerivativesBox(1)">
<div class="switchBoxTitle">{'Photo sizes'|@translate}</div>
{foreach from=$image_derivatives item=image_derivative name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
{if $image_derivative.SELECTED}
@@ -49,10 +49,10 @@ function toggleSortOrderBox() {
{/foreach}
</div>
{footer_script}{literal}
-function toggleImageDerivativesBox() {
+function toggleImageDerivativesBox(forceHide) {
var elt = document.getElementById("derivativeSwitchBox"),
ePos = document.getElementById("derivativeChooseLink");
- if (elt.style.display==="none") {
+ if (!forceHide && elt.style.display==="none") {
elt.style.position = "absolute";
elt.style.left = ePos.offsetLeft+"px";
elt.style.top = (ePos.offsetTop+ePos.offsetHeight)+"px";
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index da8309baa..ee4ec5f85 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -53,7 +53,7 @@ function toggleDerivativeSwitchBox()
{/literal}{/footer_script}
{strip}<a id="derivativeSwitchLink" href="javascript:toggleDerivativeSwitchBox()" title="{'Photo sizes'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
<span class="pwg-icon pwg-icon-sizes">&nbsp;</span><span class="pwg-button-text">{'Photo sizes'|@translate}</span></a>
-<div id="derivativeSwitchBox" class="switchBox" onclick="toggleDerivativeSwitchBox()" style="display:none" onmouseout="e=event.toElement||event.relatedTarget;e.parentNode==this||e==this||toggleDerivativeSwitchBox()">
+<div id="derivativeSwitchBox" class="switchBox" onclick="toggleDerivativeSwitchBox()" style="display:none" onmouseout="e=event.toElement||event.relatedTarget;e.parentNode==this||e.parentNode.parentNode==this||e==this||toggleDerivativeSwitchBox()">
<div class="switchBoxTitle">{'Photo sizes'|@translate}</div>
{foreach from=$current.unique_derivatives item=derivative key=derivative_type}
<span class="derivativeChecked switchCheck"