Skip to content

Commit

Permalink
Update to 2.7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdesign committed Feb 16, 2018
1 parent 0404cbc commit e384379
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion julib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<authorUrl>https://joomla-ua.org</authorUrl>
<license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
<copyright>(C) 2006-2018 Joomla! Ukraine. All rights reserved.</copyright>
<version>2.7.5</version>
<version>2.7.6</version>
<packager>Joomla! Ukraine</packager>
<packagerurl>https://joomla-ua.org</packagerurl>
<files folder="julib">
Expand Down
22 changes: 11 additions & 11 deletions julib/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
class JUImg
{
/**
* @param $url
* @param null $attr
* @param $url
* @param array $attr
*
* @return string
*/
public function Render($url, $attr = null)
public function Render($url, $attr = array())
{
if($url !== 'cover')
{
Expand Down Expand Up @@ -77,7 +77,7 @@ public function Render($url, $attr = null)
$img_cache = array();
$error_image = array();

if(!empty($attr))
if(!empty($attr) && is_array($attr))
{
foreach ($attr as $whk => $whv)
{
Expand Down Expand Up @@ -120,7 +120,7 @@ public function Render($url, $attr = null)

$md5 = array();

if(!empty($attr))
if(!empty($attr) && is_array($attr))
{
foreach ($attr as $k => $v)
{
Expand All @@ -147,14 +147,14 @@ public function Render($url, $attr = null)
}

/**
* @param $url
* @param $img_cache
* @param $target
* @param null $attr
* @param $url
* @param $img_cache
* @param $target
* @param array $attr
*
* @return string
*/
public function Create($url, $img_cache, $target, $attr = null)
public function Create($url, $img_cache, $target, $attr = array())
{
$phpThumb = new JUThumbs();

Expand All @@ -179,7 +179,7 @@ public function Create($url, $img_cache, $target, $attr = null)
{
$cover = array();

if(!empty($attr))
if(!empty($attr) && is_array($attr))
{
foreach ($attr as $whk => $whv)
{
Expand Down
2 changes: 1 addition & 1 deletion julib/phpthumb/phpthumb.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function phpThumb() {
$this->DebugMessage('phpThumb() v'.$this->phpthumb_version, __FILE__, __LINE__);

foreach (array(ini_get('memory_limit'), get_cfg_var('memory_limit')) as $php_config_memory_limit) {
if (strlen($php_config_memory_limit)) {
if ('' !== $php_config_memory_limit) {
if (strtoupper($php_config_memory_limit[ strlen($php_config_memory_limit) - 1 ]) == 'G') { // PHP memory limit expressed in Gigabytes
$php_config_memory_limit = (int) substr($php_config_memory_limit, 0, -1) * 1073741824;
} elseif (strtoupper($php_config_memory_limit[ strlen($php_config_memory_limit) - 1 ]) == 'M') { // PHP memory limit expressed in Megabytes
Expand Down
38 changes: 19 additions & 19 deletions julib/phpthumb/phpthumb.filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function BlurGaussian(&$gdimg) {
// fall through and try it the hard way
}
$this->DebugMessage('FAILED: phpthumb_filters::BlurGaussian($gdimg) [using phpthumb_filters::Blur() instead]', __FILE__, __LINE__);
return phpthumb_filters::Blur($gdimg, 0.5);
return self::Blur($gdimg, 0.5);
}


Expand Down Expand Up @@ -307,7 +307,7 @@ public function Desaturate(&$gdimg, $amount, $color='') {
if ($amount == 0) {
return true;
}
return phpthumb_filters::Colorize($gdimg, $amount, (phpthumb_functions::IsHexColor($color) ? $color : 'gray'));
return self::Colorize($gdimg, $amount, (phpthumb_functions::IsHexColor($color) ? $color : 'gray'));
}


Expand Down Expand Up @@ -420,7 +420,7 @@ public function Ellipse($gdimg) {
imagefilledellipse($gdimg_ellipsemask_double, imagesx($gdimg), imagesy($gdimg), (imagesx($gdimg) - 1) * 2, (imagesy($gdimg) - 1) * 2, $color_transparent);
imagecopyresampled($gdimg_ellipsemask, $gdimg_ellipsemask_double, 0, 0, 0, 0, imagesx($gdimg), imagesy($gdimg), imagesx($gdimg) * 2, imagesy($gdimg) * 2);

phpthumb_filters::ApplyMask($gdimg_ellipsemask, $gdimg);
self::ApplyMask($gdimg_ellipsemask, $gdimg);
imagedestroy($gdimg_ellipsemask);
return true;

Expand Down Expand Up @@ -520,7 +520,7 @@ public function Grayscale(&$gdimg) {
$this->DebugMessage('FAILED: imagefilter($gdimg, IMG_FILTER_GRAYSCALE)', __FILE__, __LINE__);
// fall through and try it the hard way
}
return phpthumb_filters::Colorize($gdimg, 100, 'gray');
return self::Colorize($gdimg, 100, 'gray');
}


Expand Down Expand Up @@ -556,7 +556,7 @@ public function HistogramStretch(&$gdimg, $band='*', $method=0, $threshold=0.1)
// equivalent of "Auto Contrast" in Adobe Photoshop
// method 0 stretches according to RGB colors. Gives a more conservative stretch.
// method 1 band stretches according to grayscale which is color-biased (59% green, 30% red, 11% blue). May give a punchier / more aggressive stretch, possibly appearing over-saturated
$Analysis = phpthumb_filters::HistogramAnalysis($gdimg, true);
$Analysis = self::HistogramAnalysis($gdimg, true);
$keys = array('r'=>'red', 'g'=>'green', 'b'=>'blue', 'a'=>'alpha', '*'=>(($method == 0) ? 'all' : 'gray'));
$band = $band[ 0 ];
if (!isset($keys[$band])) {
Expand Down Expand Up @@ -633,7 +633,7 @@ public function HistogramStretch(&$gdimg, $band='*', $method=0, $threshold=0.1)
public function HistogramOverlay(&$gdimg, $bands='*', $colors='', $width=0.25, $height=0.25, $alignment='BR', $opacity=50, $margin_x=5, $margin_y=null) {
$margin_y = (null === $margin_y ? $margin_x : $margin_y);

$Analysis = phpthumb_filters::HistogramAnalysis($gdimg, true);
$Analysis = self::HistogramAnalysis($gdimg, true);
$histW = round(($width > 1) ? min($width, imagesx($gdimg)) : imagesx($gdimg) * $width);
$histH = round(($width > 1) ? min($width, imagesx($gdimg)) : imagesx($gdimg) * $width);
if ($gdHist = imagecreatetruecolor($histW, $histH)) {
Expand Down Expand Up @@ -672,7 +672,7 @@ public function HistogramOverlay(&$gdimg, $bands='*', $colors='', $width=0.25, $
return false;
}

phpthumb_filters::WatermarkOverlay($gdimg, $gdHist, $alignment, $opacity, $margin_x, $margin_y);
self::WatermarkOverlay($gdimg, $gdHist, $alignment, $opacity, $margin_x, $margin_y);
imagedestroy($gdHist);
return true;
}
Expand Down Expand Up @@ -756,7 +756,7 @@ public static function ImprovedImageRotate(&$gdimg_source, $rotate_angle=0, $con
while ($rotate_angle < 0) {
$rotate_angle += 360;
}
$rotate_angle = $rotate_angle % 360;
$rotate_angle %= 360;
if ($rotate_angle != 0) {

$background_color = phpthumb_functions::ImageHexColorAllocate($gdimg_source, $config_background_hexcolor);
Expand Down Expand Up @@ -785,7 +785,7 @@ public static function ImprovedImageRotate(&$gdimg_source, $rotate_angle=0, $con
imagealphablending($gdimg_source, false);
imagesavealpha($gdimg_source, true);
//$this->is_alpha = true;
$phpThumbFilters = new phpthumb_filters();
$phpThumbFilters = new self();
//$phpThumbFilters->phpThumbObject = $this;
$phpThumbFilters->phpThumbObject = $phpThumbObject;
$phpThumbFilters->ApplyMask($gdimg_rotate_mask, $gdimg_source);
Expand Down Expand Up @@ -901,7 +901,7 @@ public function RoundedImageCorners(&$gdimg, $radius_x, $radius_y) {
imagecopyresampled($gdimg_cornermask, $gdimg_cornermask_triple, imagesx($gdimg) - $radius_x, imagesy($gdimg) - $radius_y, $radius_x * 3, $radius_y * 3, $radius_x, $radius_y, $radius_x * 2, $radius_y * 2);
imagecopyresampled($gdimg_cornermask, $gdimg_cornermask_triple, imagesx($gdimg) - $radius_x, 0, $radius_x * 3, $radius_y, $radius_x, $radius_y, $radius_x * 2, $radius_y * 2);

phpthumb_filters::ApplyMask($gdimg_cornermask, $gdimg);
self::ApplyMask($gdimg_cornermask, $gdimg);
imagedestroy($gdimg_cornermask);
$this->DebugMessage('RoundedImageCorners('.$radius_x.', '.$radius_y.') succeeded', __FILE__, __LINE__);
return true;
Expand All @@ -926,7 +926,7 @@ public function Saturation(&$gdimg, $amount, $color='') {
} else {
$amount = abs($amount);
}
return phpthumb_filters::Desaturate($gdimg, $amount, $color);
return self::Desaturate($gdimg, $amount, $color);
}


Expand Down Expand Up @@ -1067,7 +1067,7 @@ public function ReduceColorDepth(&$gdimg, $colors=256, $dither=true) {
$colors = max(min($colors, 256), 2);
// imagetruecolortopalette usually makes ugly colors, the replacement is a bit better
//imagetruecolortopalette($gdimg, $dither, $colors);
phpthumb_filters::ImageTrueColorToPalette2($gdimg, $dither, $colors);
self::ImageTrueColorToPalette2($gdimg, $dither, $colors);
return true;
}

Expand All @@ -1080,7 +1080,7 @@ public function WhiteBalance(&$gdimg, $targetColor='') {
'blue' => hexdec(substr($targetColor, 4, 2))
);
} else {
$Analysis = phpthumb_filters::HistogramAnalysis($gdimg, false);
$Analysis = self::HistogramAnalysis($gdimg, false);
$targetPixel = array(
'red' => max(array_keys($Analysis['red'])),
'green' => max(array_keys($Analysis['green'])),
Expand Down Expand Up @@ -1249,10 +1249,10 @@ public function WatermarkText(&$gdimg, $text, $size, $alignment, $hex_color='000
$y1 = $text_origin_y + $TTFbox[1];
$x2 = $text_origin_x + $min_x + $text_width;
$y2 = $text_origin_y + $TTFbox[1] - $text_height;
$x_TL = preg_match('#x#i', $fillextend) ? 0 : min($x1, $x2);
$y_TL = preg_match('#y#i', $fillextend) ? 0 : min($y1, $y2);
$x_BR = preg_match('#x#i', $fillextend) ? imagesx($gdimg) : max($x1, $x2);
$y_BR = preg_match('#y#i', $fillextend) ? imagesy($gdimg) : max($y1, $y2);
$x_TL = false !== stripos($fillextend, "x") ? 0 : min($x1, $x2);
$y_TL = false !== stripos($fillextend, "y") ? 0 : min($y1, $y2);
$x_BR = false !== stripos($fillextend, "x") ? imagesx($gdimg) : max($x1, $x2);
$y_BR = false !== stripos($fillextend, "y") ? imagesy($gdimg) : max($y1, $y2);
$this->DebugMessage('WatermarkText() calling imagefilledrectangle($gdimg, '.$x_TL.', '.$y_TL.', '.$x_BR.', '.$y_BR.', $text_color_background)', __FILE__, __LINE__);
imagefilledrectangle($gdimg, $x_TL, $y_TL, $x_BR, $y_BR, $text_color_background);

Expand Down Expand Up @@ -1407,11 +1407,11 @@ public function WatermarkText(&$gdimg, $text, $size, $alignment, $hex_color='000
if ($angle && $img_watermark_mask) {
$img_watermark = imagerotate($img_watermark, $angle, $text_color_background);
$img_watermark_mask = imagerotate($img_watermark_mask, $angle, $mask_color_background);
phpthumb_filters::ApplyMask($img_watermark_mask, $img_watermark);
self::ApplyMask($img_watermark_mask, $img_watermark);
}
//phpthumb_filters::WatermarkOverlay($gdimg, $img_watermark, $alignment, $opacity, $margin);
$this->DebugMessage('WatermarkText() calling phpthumb_filters::WatermarkOverlay($gdimg, $img_watermark, '.($originOffsetX.'x'.$originOffsetY).', '.$opacity.', 0)', __FILE__, __LINE__);
phpthumb_filters::WatermarkOverlay($gdimg, $img_watermark, $originOffsetX.'x'.$originOffsetY, $opacity, 0);
self::WatermarkOverlay($gdimg, $img_watermark, $originOffsetX.'x'.$originOffsetY, $opacity, 0);
imagedestroy($img_watermark);
return true;
}
Expand Down
Loading

0 comments on commit e384379

Please sign in to comment.