Changeset 13736


Ignore:
Timestamp:
Mar 26, 2012, 6:07:03 AM (9 years ago)
Author:
rvelices
Message:
  • small js fixes on index/picture
  • i.php does not use derivatives.dat file anymore (obsolete file)
  • better selection of derivatives in picture.php
  • larger sharpen real range in image.class.php
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/image.class.php

    r13426 r13736  
    266266  static function get_sharpen_matrix($amount)
    267267  {
    268                 // Amount should be in the range of 24-10
    269                 $amount = round(abs(-24 + ($amount * 0.14)), 2);
     268                // Amount should be in the range of 28-10
     269                $amount = round(abs(-28 + ($amount * 0.18)), 2);
    270270
    271271                $matrix = array
  • trunk/i.php

    r13651 r13736  
    2929defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', $conf['data_location'].'i/');
    3030
     31@include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php');
     32
     33
    3134function trigger_action() {}
    3235function get_extension( $filename )
     
    373376}
    374377
     378include_once(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
    375379include_once( PHPWG_ROOT_PATH .'/include/derivative_params.inc.php');
    376380include_once( PHPWG_ROOT_PATH .'/include/derivative_std_params.inc.php');
    377381
    378 ImageStdParams::load_from_file();
     382try
     383{
     384  $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'],
     385                                $conf['db_password'], $conf['db_base']);
     386}
     387catch (Exception $e)
     388{
     389  ilog("db error", $e->getMessage());
     390}
     391list($conf['derivatives']) = pwg_db_fetch_row(pwg_query('SELECT value FROM '.$prefixeTable.'config WHERE param=\'derivatives\''));
     392ImageStdParams::load_from_db();
    379393
    380394
     
    429443    && strpos($page['src_location'], 'plugins/')===false)
    430444{
    431   @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php');
    432   include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
    433445  try
    434446  {
    435     $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'],
    436                                   $conf['db_password'], $conf['db_base']);
    437447    $query = 'SELECT coi, width, height FROM '.$prefixeTable.'images WHERE path=\''.$page['src_location'].'\'';
    438448    if ( ($row=pwg_db_fetch_assoc(pwg_query($query))) )
     
    444454      $page['coi'] = $row['coi'];
    445455    }
    446     mysql_close($pwg_db_link);
    447456    if (!$row)
    448457    {
     
    455464  }
    456465}
     466mysql_close($pwg_db_link);
    457467
    458468try_switch_source($params, $src_mtime);
  • trunk/include/derivative_std_params.inc.php

    r13683 r13736  
    118118  }
    119119
    120   static function load_from_file()
    121   {
    122     global $conf;
    123     $arr = @unserialize(@file_get_contents(PHPWG_ROOT_PATH.$conf['data_location'].'derivatives.dat'));
    124     if (false!==$arr)
    125     {
    126       self::$type_map = $arr['d'];
    127       self::$watermark = @$arr['w'];
    128       if (!self::$watermark) self::$watermark = new WatermarkParams();
    129       self::$custom = @$arr['c'];
    130       if (!self::$custom) self::$custom = array();
    131     }
    132     else
    133     {
    134       self::make_default();
    135     }
    136     self::build_maps();
    137   }
    138 
    139120  static function set_watermark($watermark)
    140121  {
     
    159140      ) );
    160141    conf_update_param('derivatives', addslashes($ser) );
    161     file_put_contents(PHPWG_ROOT_PATH.$conf['data_location'].'derivatives.dat', $ser);
    162142  }
    163143
  • trunk/picture.php

    r13115 r13736  
    173173    if ($type==IMG_SQUARE || $type==IMG_THUMB)
    174174      continue;
     175    if (!array_key_exists($type, ImageStdParams::get_defined_type_map()))
     176      continue;
    175177    $url = $derivative->get_url();
    176178    if (isset($added[$url]))
  • trunk/themes/default/template/index.tpl

    r13729 r13736  
    88                        <span class="pwg-icon pwg-icon-sort">&nbsp;</span><span class="pwg-button-text">{'Sort order'|@translate}</span>
    99                </a>
    10                 <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()">
     10                <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)">
    1111                        <div class="switchBoxTitle">{'Sort order'|@translate}</div>
    1212                        {foreach from=$image_orders item=image_order name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
     
    1919                </div>
    2020                {footer_script}{literal}
    21 function toggleSortOrderBox() {
     21function toggleSortOrderBox(forceHide) {
    2222        var elt = document.getElementById("sortOrderBox"),
    2323                ePos = document.getElementById("sortOrderLink");
    24         if (elt.style.display==="none") {
     24        if (!forceHide && elt.style.display==="none") {
    2525                elt.style.position = "absolute";
    2626                elt.style.left = ePos.offsetLeft+"px";
     
    3939                        <span class="pwg-icon pwg-icon-sizes">&nbsp;</span><span class="pwg-button-text">{'Photo sizes'|@translate}</span>
    4040                </a>
    41                 <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()">
     41                <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)">
    4242                        <div class="switchBoxTitle">{'Photo sizes'|@translate}</div>
    4343                        {foreach from=$image_derivatives item=image_derivative name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
     
    5050                </div>
    5151                {footer_script}{literal}
    52 function toggleImageDerivativesBox() {
     52function toggleImageDerivativesBox(forceHide) {
    5353        var elt = document.getElementById("derivativeSwitchBox"),
    5454                ePos = document.getElementById("derivativeChooseLink");
    55         if (elt.style.display==="none") {
     55        if (!forceHide && elt.style.display==="none") {
    5656                elt.style.position = "absolute";
    5757                elt.style.left = ePos.offsetLeft+"px";
  • trunk/themes/default/template/picture.tpl

    r13729 r13736  
    5454{strip}<a id="derivativeSwitchLink" href="javascript:toggleDerivativeSwitchBox()" title="{'Photo sizes'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
    5555<span class="pwg-icon pwg-icon-sizes">&nbsp;</span><span class="pwg-button-text">{'Photo sizes'|@translate}</span></a>
    56 <div id="derivativeSwitchBox" class="switchBox" onclick="toggleDerivativeSwitchBox()" style="display:none" onmouseout="e=event.toElement||event.relatedTarget;e.parentNode==this||e==this||toggleDerivativeSwitchBox()">
     56<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()">
    5757<div class="switchBoxTitle">{'Photo sizes'|@translate}</div>
    5858{foreach from=$current.unique_derivatives item=derivative key=derivative_type}
Note: See TracChangeset for help on using the changeset viewer.