dever 4 年 前
コミット
3b4d86d154
1 ファイル変更14 行追加2 行削除
  1. 14 2
      src/Api.php

+ 14 - 2
src/Api.php

@@ -38,8 +38,20 @@ class Api
 
             if ($logo) {
                 $logo = Dever::local($logo);
-                $QR = imagecreatefromstring(file_get_contents($file));
-                $logo = imagecreatefromstring(file_get_contents($logo));
+                if (strstr($file, 'http')) {
+                    $file_string = Dever::curl($file);
+                } else {
+                    $file_string = file_get_contents($file);
+                }
+
+                if (strstr($logo, 'http')) {
+                    $logo_string = Dever::curl($logo);
+                } else {
+                    $logo_string = file_get_contents($logo);
+                }
+                
+                $QR = imagecreatefromstring($file_string);
+                $logo = imagecreatefromstring($logo_string);
                 $QR_width = imagesx($QR);//二维码图片宽度
                 $QR_height = imagesy($QR);//二维码图片高度
                 $logo_width = imagesx($logo);//logo图片宽度