mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-10 10:42:59 +02:00
multisize - added the coi (still to affine the admin ui + language)
multisize - derivatives can be revuild from a larger derviative instead of the original git-svn-id: http://piwigo.org/svn/trunk@13038 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -84,10 +84,10 @@ function pwg_query($query)
|
||||
{
|
||||
global $conf,$page,$debug,$t2;
|
||||
|
||||
$start = get_moment();
|
||||
$start = microtime(true);
|
||||
($result = mysql_query($query)) or my_error($query, $conf['die_on_sql_error']);
|
||||
|
||||
$time = get_moment() - $start;
|
||||
$time = microtime(true) - $start;
|
||||
|
||||
if (!isset($page['count_queries']))
|
||||
{
|
||||
@@ -199,7 +199,7 @@ function array_from_query($query, $fieldname)
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
{
|
||||
array_push($array, $row[$fieldname]);
|
||||
$array[] = $row[$fieldname];
|
||||
}
|
||||
|
||||
return $array;
|
||||
|
||||
@@ -27,14 +27,13 @@ final class SrcImage
|
||||
public $id;
|
||||
public $rel_path;
|
||||
|
||||
public $coi=null;
|
||||
private $size=null;
|
||||
private $flags=0;
|
||||
|
||||
function __construct($infos)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$this->id = $infos['id'];
|
||||
$ext = get_extension($infos['path']);
|
||||
if (in_array($ext, $conf['picture_ext']))
|
||||
@@ -54,7 +53,6 @@ final class SrcImage
|
||||
$this->size = @getimagesize(PHPWG_ROOT_PATH.$this->rel_path);
|
||||
}
|
||||
|
||||
$this->coi = @$infos['coi'];
|
||||
if (!$this->size && isset($infos['width']) && isset($infos['height']))
|
||||
{
|
||||
$this->size = array($infos['width'], $infos['height']);
|
||||
@@ -168,11 +166,6 @@ final class DerivativeImage
|
||||
$tokens=array();
|
||||
$tokens[] = substr($params->type,0,2);
|
||||
|
||||
if ($params->sizing->max_crop != 0 and !empty($src->coi))
|
||||
{
|
||||
$tokens[] = 'ci'.$src->coi;
|
||||
}
|
||||
|
||||
if ($params->type==IMG_CUSTOM)
|
||||
{
|
||||
$params->add_url_tokens($tokens);
|
||||
@@ -257,7 +250,7 @@ final class DerivativeImage
|
||||
{
|
||||
return $this->src_image->get_size();
|
||||
}
|
||||
return $this->params->compute_final_size($this->src_image->get_size(), $this->src_image->coi);
|
||||
return $this->params->compute_final_size($this->src_image->get_size());
|
||||
}
|
||||
|
||||
function get_size_htm()
|
||||
|
||||
@@ -45,7 +45,7 @@ function char_to_fraction($c)
|
||||
|
||||
function fraction_to_char($f)
|
||||
{
|
||||
return ord('a') + round($f*25);
|
||||
return chr(ord('a') + round($f*25));
|
||||
}
|
||||
|
||||
/** small utility to manipulate a 'rectangle'*/
|
||||
@@ -257,9 +257,9 @@ final class DerivativeParams
|
||||
$this->sizing->add_url_tokens($tokens);
|
||||
}
|
||||
|
||||
function compute_final_size($in_size, $coi)
|
||||
function compute_final_size($in_size)
|
||||
{
|
||||
$this->sizing->compute( $in_size, $coi, $crop_rect, $scale_size );
|
||||
$this->sizing->compute( $in_size, null, $crop_rect, $scale_size );
|
||||
return $scale_size != null ? $scale_size : $in_size;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ final class ImageStdParams
|
||||
{
|
||||
return self::$all_type_map[$type];
|
||||
}
|
||||
|
||||
|
||||
static function get_custom($w, $h, $crop=0, $minw=null, $minh=null)
|
||||
{
|
||||
$params = new DerivativeParams( new SizingParams( array($w,$h), $crop, array($minw,$minh)) );
|
||||
@@ -103,6 +103,8 @@ final class ImageStdParams
|
||||
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
|
||||
{
|
||||
@@ -134,7 +136,7 @@ final class ImageStdParams
|
||||
{
|
||||
self::$watermark = $watermark;
|
||||
}
|
||||
|
||||
|
||||
static function set_and_save($map)
|
||||
{
|
||||
self::$type_map = $map;
|
||||
@@ -176,7 +178,7 @@ final class ImageStdParams
|
||||
$params->use_watermark = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static function build_maps()
|
||||
{
|
||||
foreach (self::$type_map as $type=>$params)
|
||||
|
||||
Reference in New Issue
Block a user