コード例 #1
0
ファイル: images.php プロジェクト: rigidus/ea
 function text($str, $direct = 'bottom')
 {
     self::getSizes();
     self::$output_type = strtolower(substr(self::getMime(), strpos(self::getMime(), '/') + 1));
     $icfunc = "imagecreatefrom" . self::$output_type;
     $img = @$icfunc(self::$original);
     $color = imagecolorallocatealpha($img, self::$r, self::$g, self::$b, 0);
     if ($direct == 'bottom') {
         if (self::$font) {
             $font_y = self::$font_size * 1.3;
             imagettftext($img, self::$font_size, 0, 10, self::getHeight() - $font_y, $color, self::$font, $str);
         } else {
             imagestring($img, 2, 5, self::getHeight() - 17, $str, $color);
         }
     } else {
         if ($direct == 'top') {
             if (self::$font) {
                 $font_y = self::$font_size * 2;
                 imagettftext($img, self::$font_size, 0, 10, $font_y, $color, self::$font, $str);
             } else {
                 imagestring($img, 2, 5, 2, $str, $color);
             }
         }
     }
     imagejpeg($img, self::$thumb, self::$quality);
     self::destroy();
 }