Skip to content

Commit

Permalink
bugfix: add \ to gf functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sayadaazami committed Jan 2, 2017
1 parent 9849f51 commit 1f797f9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Plate.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,16 @@ public function isCab(){
public function getImage($exportPath){
$imageName = $this->_getImageNameBasedOnChar();
$color = $this->_getColorNameBasedOnChar();
$this->_image = imagecreatefrompng($this->_resourcePath . $imageName);
$width = imagesx($this->_image);
$height = imagesy($this->_image);
$this->_image = \imagecreatefrompng($this->_resourcePath . $imageName);
$width = \imagesx($this->_image);
$height = \imagesy($this->_image);

$this->_drawAllChars($color); // draw text
$this->_drawEnglishPlate(); // draw eng plate

//save image
imagepng($this->_image, $exportPath);
imagedestroy($this->_image);
\imagepng($this->_image, $exportPath);
\imagedestroy($this->_image);
}

public function withDate($date){
Expand Down Expand Up @@ -215,12 +215,12 @@ private function _drawChar($text, $font, $fontSize, $color, $x=0, $y=0){
$y += $fontSize;

foreach (array_reverse($colors) as $index=>$color) {
$color = imagecolorallocate($this->_image, $color, $color, $color);
$color = \imagecolorallocate($this->_image, $color, $color, $color);
$xx = $x - $index * .2;
$yy = $y + $index * .2;
$ff = $fontSize + ($count - $index * .7);

imagettftext($this->_image, $ff, 0, $xx, $yy , $color, $font, $text);
\imagettftext($this->_image, $ff, 0, $xx, $yy , $color, $font, $text);
}
}

Expand Down Expand Up @@ -260,14 +260,14 @@ private function _getColorNameBasedOnChar(){

private function _drawEnglishPlate(){
$font = $this->_resourcePath . 'font.ttf';
$textcolor = imagecolorallocate($this->_image, 150, 150, 150);
$textcolor = \imagecolorallocate($this->_image, 150, 150, 150);
$eng = $this->_engChars[$this->_parsed['char']];
$text = $this->_parsed['2DigitNumber'] . $eng . $this->_parsed['3DigitNumber'] . '-' . $this->_parsed['stateNumber'];

imagettftext($this->_image, 9, 0, 125, 78 , $textcolor, $font, $text);
\imagettftext($this->_image, 9, 0, 125, 78 , $textcolor, $font, $text);

if (!empty($this->_date)) {
imagettftext($this->_image, 9, 0, 282, 79 , $textcolor, $font, $this->_date);
\imagettftext($this->_image, 9, 0, 282, 79 , $textcolor, $font, $this->_date);
}
}
}

0 comments on commit 1f797f9

Please sign in to comment.