Skip to content

Commit

Permalink
Update to 2.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdesign committed Oct 5, 2018
1 parent 4e232e1 commit 4182fbc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<project name="julib" default="dist" basedir=".">

<property name="VERSION" value="2.8.1"/>
<property name="VERSION" value="2.9.0"/>

<tstamp>
<format property="DATE" pattern="%d.%m.%Y" />
Expand Down
4 changes: 2 additions & 2 deletions julib/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function Render($url, array $attr = [])
$url = rawurldecode($url);

$_error = 0;
if( preg_match('#^(http|https|ftp)://#i', $url) )
if( strpos($url, 'http://') === 0 || strpos($url, 'https://') === 0 )
{
$headers = @get_headers($url);
if( strpos($headers[ 0 ], '200') === false )
Expand Down Expand Up @@ -275,7 +275,7 @@ public function make_dir($dir, $mode = 0777)
return true;
}

if( !$this->make_dir(dirname($dir), $mode) )
if( !$this->make_dir(dirname($dir)) )
{
return false;
}
Expand Down
26 changes: 13 additions & 13 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 self::Blur($gdimg, 0.5);
return $this->Blur($gdimg, 0.5);
}


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

self::ApplyMask($gdimg_ellipsemask, $gdimg);
$this->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 self::Colorize($gdimg, 100, 'gray');
return $this->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 = self::HistogramAnalysis($gdimg, true);
$Analysis = $this->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 = self::HistogramAnalysis($gdimg, true);
$Analysis = $this->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;
}

self::WatermarkOverlay($gdimg, $gdHist, $alignment, $opacity, $margin_x, $margin_y);
$this->WatermarkOverlay($gdimg, $gdHist, $alignment, $opacity, $margin_x, $margin_y);
imagedestroy($gdHist);
return true;
}
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);

self::ApplyMask($gdimg_cornermask, $gdimg);
$this->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 self::Desaturate($gdimg, $amount, $color);
return $this->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);
self::ImageTrueColorToPalette2($gdimg, $dither, $colors);
$this->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 = self::HistogramAnalysis($gdimg, false);
$Analysis = $this->HistogramAnalysis($gdimg, false);
$targetPixel = array(
'red' => max(array_keys($Analysis['red'])),
'green' => max(array_keys($Analysis['green'])),
Expand Down Expand Up @@ -1408,11 +1408,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);
self::ApplyMask($img_watermark_mask, $img_watermark);
$this->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__);
self::WatermarkOverlay($gdimg, $img_watermark, $originOffsetX.'x'.$originOffsetY, $opacity, 0);
$this->WatermarkOverlay($gdimg, $img_watermark, $originOffsetX.'x'.$originOffsetY, $opacity, 0);
imagedestroy($img_watermark);
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions julib/phpthumb/phpthumb.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,8 @@ public static function SafeURLread($url, &$error, $timeout=10, $followredirects=
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, (bool) $followredirects);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
$rawData = curl_exec($ch);
Expand Down
2 changes: 1 addition & 1 deletion julib/phpthumb/phpthumb.gif.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function gif_outputAsPng($gif, $lpszFileName, $bgColor = -1)
function gif_outputAsJpeg($gif, $lpszFileName, $bgColor = -1)
{
// JPEG output that does not require cjpeg added by James Heinrich <[email protected]> - December 10, 2003
if ((strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') && (file_exists('/usr/local/bin/cjpeg') || `which cjpeg`)) {
if ((strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') && (file_exists('/usr/local/bin/cjpeg') || shell_exec("which cjpeg"))) {

if (gif_outputAsBmp($gif, $lpszFileName.'.bmp', $bgColor)) {
exec('cjpeg '.$lpszFileName.'.bmp >'.$lpszFileName.' 2>/dev/null');
Expand Down

0 comments on commit 4182fbc

Please sign in to comment.