Skip to content

Commit 1a63c7d

Browse files
author
Alex Corretge
committed
don't throw exception when The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.
1 parent bd94a71 commit 1a63c7d

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/gd_image.inc.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ function SetAntiAliasing($aFlg=true) {
107107
imageantialias($this->img,$aFlg);
108108
}
109109
else {
110-
JpGraphError::RaiseL(25128);//('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.')
110+
// don't throw an error
111+
// JpGraphError::RaiseL(25128);//('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.')
111112
}
112113
}
113114

@@ -504,7 +505,7 @@ function StrokeBoxedText2($x,$y,$txt,$dir=0,$fcolor="white",$bcolor="black",
504505

505506
$x -= $rect_width/2;
506507
$x += sin($dir*M_PI/180)*$height;
507-
$y += $rect_height/2;
508+
$y += $rect_height/2;
508509

509510
} elseif( $dir >= 270 && $dir <= 360 ) {
510511

@@ -755,7 +756,7 @@ function imagettfbbox_fixed($size, $angle, $fontfile, $text) {
755756
// box is sometimes coinciding with the first pixel of the text
756757
//$bbox[0] -= 1;
757758
//$bbox[6] -= 1;
758-
759+
759760
// For roatated text we need to add extra width for rotated
760761
// text since the kerning and stroking of the TTF is not the same as for
761762
// text at a 0 degree angle
@@ -908,7 +909,7 @@ function _StrokeTTF($x,$y,$txt,$dir,$paragraph_align,&$aBoundingBox,$debug=false
908909

909910
if( $this->text_valign != 'basepoint' ) {
910911
// Align x,y ot lower left corner of bbox
911-
912+
912913

913914
if( $this->text_halign=='right' ) {
914915
$x -= $width;
@@ -935,7 +936,7 @@ function _StrokeTTF($x,$y,$txt,$dir,$paragraph_align,&$aBoundingBox,$debug=false
935936
// This is only support for text at 0 degree !!
936937
// Do nothing the text is drawn at baseline by default
937938
}
938-
}
939+
}
939940
ImageTTFText ($this->img, $this->font_size, $dir, $x, $y,
940941
$this->current_color,$this->font_file,$txt);
941942

@@ -1337,7 +1338,7 @@ function DashedLine($x1,$y1,$x2,$y2,$dash_length=1,$dash_space=4) {
13371338
if( $this->use_anti_aliasing ) {
13381339
// JpGraphError::RaiseL(25129); // Anti-alias can not be used with dashed lines. Please disable anti-alias or use solid lines.
13391340
}
1340-
1341+
13411342
$x1 = round($x1);
13421343
$x2 = round($x2);
13431344
$y1 = round($y1);
@@ -1365,12 +1366,12 @@ function DashedLineForGrid($x1,$y1,$x2,$y2,$dash_length=1,$dash_space=4) {
13651366
if( $this->use_anti_aliasing ) {
13661367
// JpGraphError::RaiseL(25129); // Anti-alias can not be used with dashed lines. Please disable anti-alias or use solid lines.
13671368
}
1368-
1369+
13691370
$x1 = round($x1);
13701371
$x2 = round($x2);
13711372
$y1 = round($y1);
13721373
$y2 = round($y2);
1373-
1374+
13741375
/*
13751376
$dash_length *= $this->scale;
13761377
$dash_space *= $this->scale;
@@ -1749,11 +1750,11 @@ function DrawLine($im, $x1, $y1, $x2, $y2, $weight, $color) {
17491750
return imageline($im,$x1,$y1,$x2,$y2,$color);
17501751
}
17511752

1752-
$angle=(atan2(($y1 - $y2), ($x2 - $x1)));
1753+
$angle=(atan2(($y1 - $y2), ($x2 - $x1)));
17531754

17541755
$dist_x = $weight * (sin($angle)) / 2;
17551756
$dist_y = $weight * (cos($angle)) / 2;
1756-
1757+
17571758
$p1x=ceil(($x1 + $dist_x));
17581759
$p1y=ceil(($y1 + $dist_y));
17591760
$p2x=ceil(($x2 + $dist_x));
@@ -1800,12 +1801,12 @@ function DrawLine($im, $x1, $y1, $x2, $y2, $weight, $color) {
18001801
$pts[] = $x2 - $weight; $pts[] = $y2;
18011802

18021803
} else {
1803-
1804+
18041805
var_dump($x1, $x2, $y1, $y2);
18051806
$length = sqrt(pow($x2 - $x1, 2) + pow($y2 - $y1, 2));
18061807
var_dump($length);exit;
18071808
exit;
1808-
1809+
18091810
/*
18101811
$lean = ($y2 - $y1) / ($x2 - $x1);
18111812
$lean2 = -1 / $lean;
@@ -1822,7 +1823,7 @@ function DrawLine($im, $x1, $y1, $x2, $y2, $weight, $color) {
18221823
//print_r($pts);exit;
18231824
if (count($pts)/2 < 3) {
18241825
return;
1825-
}
1826+
}
18261827

18271828
imagesetthickness($im, 1);
18281829
imagefilledpolygon($im, $pts,count($pts)/2, $color);
@@ -1843,7 +1844,7 @@ function DrawImageSmoothArc($im, $xc, $yc, $w, $h, $s, $e, $color, $style = null
18431844
}
18441845

18451846
function CreateColorForImageSmoothArc($color) {
1846-
$alpha = $color >> 24 & 0xFF;
1847+
$alpha = $color >> 24 & 0xFF;
18471848
$red = $color >> 16 & 0xFF;
18481849
$green = $color >> 8 & 0xFF;
18491850
$blue = $color & 0xFF;
@@ -1915,13 +1916,13 @@ function __get($name) {
19151916
return $this->$variable_name;
19161917
}
19171918

1918-
$variable_name = '_' . $name;
1919+
$variable_name = '_' . $name;
19191920

19201921
if (isset($this->$variable_name)) {
19211922
return $this->$variable_name * SUPERSAMPLING_SCALE;
19221923
} else {
19231924
JpGraphError::RaiseL('25132', $name);
1924-
}
1925+
}
19251926
}
19261927

19271928
function __set($name, $value) {

0 commit comments

Comments
 (0)