Beispiel #1
0
 public static function imageRotate($filename, $degrees)
 {
     $sizeinfo = self::getImageInfo($filename);
     if (!is_array($sizeinfo)) {
         return $sizeinfo;
     }
     $original = self::openImageFile($filename, $sizeinfo);
     if (!is_resource($original)) {
         return $original;
     }
     $color = imagecolorclosesthwb($original, 255, 255, 255);
     return imagerotate($original, $degrees, $color);
 }
Beispiel #2
0
function pathos_image_rotate($filename, $degrees)
{
    $sizeinfo = pathos_image_sizeinfo($filename);
    if (!is_array($sizeinfo)) {
        return $sizeinfo;
    }
    $original = pathos_image_createFromFile($filename, $sizeinfo);
    if (!is_resource($original)) {
        return $original;
    }
    $color = imagecolorclosesthwb($original, 255, 255, 255);
    return imagerotate($original, $degrees, $color);
}
Beispiel #3
0
 public function closestHwb(string $rgb) : int
 {
     $rgb = explode('|', $rgb);
     $red = isset($rgb[0]) ? $rgb[0] : 0;
     $green = isset($rgb[1]) ? $rgb[1] : 0;
     $blue = isset($rgb[2]) ? $rgb[2] : 0;
     return imagecolorclosesthwb($this->canvas, $red, $green, $blue);
 }
Beispiel #4
0
<?php

$im = imagecreatefrompng(dirname(__FILE__) . '/test.png');
var_dump(imagecolorclosesthwb($im, 255, 50, 0));
var_dump(imagecolorclosesthwb(NULL));
var_dump(imagecolorclosesthwb(NULL, NULL, NULL, NULL));
var_dump(imagecolorclosesthwb($im, "hello", "from", "gd"));
imagedestroy($im);
Beispiel #5
0
 public function closestHwb($rgb = '')
 {
     if (!is_string($rgb)) {
         Error::set(lang('Error', 'stringParameter', '1.(rgb)'));
         return false;
     }
     $rgb = explode('|', $rgb);
     $red = isset($rgb[0]) ? $rgb[0] : 0;
     $green = isset($rgb[1]) ? $rgb[1] : 0;
     $blue = isset($rgb[2]) ? $rgb[2] : 0;
     return imagecolorclosesthwb($this->canvas, $red, $green, $blue);
 }