JBZoo\Utils\Image::rotate PHP Method

rotate() public static method

public static rotate ( integer $color ) : integer
$color integer
return integer
    public static function rotate($color)
    {
        return self::range($color, -360, 360);
    }

Usage Example

Beispiel #1
0
 /**
  * Rotate an image
  *
  * @param resource     $image   Image GD resource
  * @param int          $angle   -360 < x < 360
  * @param string|array $bgColor Hex color string, array(red, green, blue) or array(red, green, blue, alpha).
  *                              Where red, green, blue - integers 0-255, alpha - integer 0-127
  * @return resource
  * @throws \JBZoo\Utils\Exception
  */
 public static function rotate($image, $angle, $bgColor = '#000000')
 {
     // Perform the rotation
     $angle = Helper::rotate($angle);
     $rgba = Helper::normalizeColor($bgColor);
     $bgColor = imagecolorallocatealpha($image, $rgba[0], $rgba[1], $rgba[2], $rgba[3]);
     $newImage = imagerotate($image, -$angle, $bgColor);
     Helper::addAlpha($newImage);
     return $newImage;
 }
All Usage Examples Of JBZoo\Utils\Image::rotate