<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 生成海報 * * * * * 生成海報之前需要準備二維碼和海報背景圖。 二維碼可參考上面的章節生成,并將路徑保存到相應的數據表中。 海報可以根據實際情況處理,可以是靜態固定的背景圖片也可以是設置上傳的背景圖。 此處為演示方面暫時用靜態圖片演示海報生成功能。 上層代碼如下 ``` /** * 生成海報 */ public function demoPoster() { // windows $poster_data = create_poster( "D:/xampp/htdocs/OneBase/public/upload/extend/qrcode/e9ff27b4d969cfad54b5388c381e2022.png", "D:/xampp/htdocs/OneBase/public/upload/extend/poster/poster_bg.jpg", 200, [200,100] ); // linux /* $poster_data = create_poster( "./upload/extend/qrcode/e9ff27b4d969cfad54b5388c381e2022.png", "./upload/extend/poster/poster_bg.jpg", 200, [200,100] ); */ dump($poster_data); } ``` 海報生成函數如下 函數所在文件(app/extend.php) ``` /** * 生成海報 * @param staring $qrcode_path 海報二維碼圖片路徑 * @param staring $poster_bg_path 海報背景圖片路徑 * @param int $qrcode_size 二維碼大小 * @param array $location 二維碼位置,數組中包含2個值,分別代表x y距離,通過此參數調整二維碼在海報中的位置 */ function create_poster($qrcode_path = '', $poster_bg_path = '', $qrcode_size = 200, $location = [0,0]) { // 海報目錄路徑 $poster_path = './upload/extend/poster/'; // 將二維碼生成縮略圖 if (file_exists($qrcode_path) && file_exists($poster_bg_path)) { $qrcode_tmp_file = md5($qrcode_path).'_qrcode.jpg'; $qrcode_tmp_file_path = $poster_path . $qrcode_tmp_file; $image_thumb = \think\Image::open($qrcode_path); $image_thumb->thumb($qrcode_size, $qrcode_size,\think\Image::THUMB_SCALING)->save($qrcode_tmp_file_path); $poster_file_name = md5($qrcode_path).'_poster.jpg'; $poster_file_path = $poster_path .$poster_file_name; $image_water = \think\Image::open($poster_bg_path); $image_water->water($qrcode_tmp_file_path, $location)->save($poster_file_path); @unlink($qrcode_tmp_file_path); $return_data['name'] = $poster_file_name; $return_data['path'] = $poster_file_path; return $return_data; } else { return false; } } ``` 執行結果返回了海報的文件名稱和保存的路徑 ``` array(2) { ["name"] => string(43) "847cc36b83d8c1fe3f97db5953e9fc46_poster.jpg" ["path"] => string(66) "./upload/extend/poster/847cc36b83d8c1fe3f97db5953e9fc46_poster.jpg" } ``` 效果圖 ![](https://img.kancloud.cn/23/5b/235bf8aa2fe1d0e64b852cd05bc1526e_650x866.jpg) create_poster函數僅演示海報生成,若滿足不了需求,比如您需要在海報中寫入會員昵稱。 可修改create_poster函數,調用$image->text()方法將文字寫入海報。
                  <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>

                              哎呀哎呀视频在线观看