<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                >[info] 根據用戶名生成默認文字頭像 ~~~ /** * 根據用戶名生成默認文字頭像 * @param $text * @return false|string */ function createAvatar($text){ $randBg = [ ['31','38','35'], ['199','210','212'], ['34','162','195'], ['27','167','132'], ['236','43','36'], ['222','118','34'] ]; $bg = $randBg[ array_rand($randBg)]; //隨機獲取背景 $image = imagecreate(200,200); //創建畫布 $color = imagecolorallocate($image,$bg[0],$bg[1],$bg[2]); //為畫布分配顏色 imagefilledrectangle($image, 0, 0, 199, 199, $color); //填充顏色到背景 $fontSize = 90; //字體大小 $font_file = "D:/phpstudy_pro/WWW/"."FZDeSHJW_506L.TTF"; //字體文件 * 修改成自己的字體路徑 $pos = ImageTTFBBox($fontSize,0,$font_file,$text);// 計算字符的寬高 獲得字體初始的8個相對位置 // 居中公式 (畫布寬 - 字體的寬度)/ 2 - 字體初始位置的偏移量 $left_x = intval((200 - abs($pos[2] - $pos[0])) / 2 - abs($pos[0])); $left_y = intval((200 - abs($pos[5] - $pos[3])) / 2 + abs($pos[5])); $color2 = imagecolorallocate($image,255,255,255); //為字體分配顏色 imagefttext($image,$fontSize,0,$left_x,$left_y,$color2,$font_file,$text); //填充文案到畫布里 $fileName = 'Avatar_'.time().'.png'; //文件名稱,避免重復生成 $localFilePath = "D:/phpstudy_pro/WWW/".$fileName;//本地存儲路徑 * 修改成自己存放文件的路徑 imagepng($image,$localFilePath);//生成圖像并保持本地 if(file_exists($localFilePath)){ return '/static/tmp/avatar/'.$fileName; }else{ return null; } } ~~~ * **調用示例:** ~~~ $arr = ['王三三','李三三','張三三','黎三三','宋三三']; createAvatar(mb_substr($arr[array_rand($arr)], 0, 1)); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看