1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Upgrade PHP thumb and watermarks for images added

This commit is contained in:
CaMer0n
2012-07-02 01:32:56 +00:00
parent 92fc540ac6
commit cadadb29b9
11 changed files with 631 additions and 114 deletions

View File

@@ -123,8 +123,10 @@ class e_thumbpage
function parseRequest()
{
//echo 'e_query='.str_replace('&', '&', e_QUERY);
parse_str(str_replace('&', '&', e_QUERY), $this->_request);
//parse_str($_SERVER['QUERY_STRING'], $this->_request);
// parse_str($_SERVER['QUERY_STRING'], $this->_request);
return $this;
}
@@ -228,6 +230,23 @@ class e_thumbpage
$thumb->adaptiveResize((integer) vartrue($this->_request['aw'], 0), (integer) vartrue($this->_request['ah'], 0));
}
//TODO Move to $_SESSION and activate based on width/height ie. watermark all images larger than....
// ie. prevent user tampering with URLs.
if(isset($this->_request['wm']))
{
$tp = e107::getParser();
$tmp = explode("|",$this->_request['wm']);
$tmp[4] = $tp->createConstants($tmp[4], 'mix');
$tmp[4] = realpath($tp->replaceConstants($tmp[4],'rel'));
$thumb->WatermarkText($tmp);
// $alignment='BR', $hex_color='000000', $ttffont='', $opacity=100, $margin=5, $angle=0, $bg_color=false, $bg_opacity=0, $fillextend=''
}
// set cache
$thumb->save(e_CACHE_IMAGE.$fname);
@@ -242,6 +261,7 @@ class e_thumbpage
$ret['h'] = isset($this->_request['h']) ? intval($this->_request['h']) : $ret['w'];
$ret['aw'] = isset($this->_request['aw']) ? intval($this->_request['aw']) : false;
$ret['ah'] = isset($this->_request['ah']) ? intval($this->_request['ah']) : $ret['aw'];
$ret['wm'] = isset($this->_request['wm']) ? intval($this->_request['wm']) : $ret['wm'];
return $ret;
}