|
|
@@ -27,9 +27,9 @@ use common\components\wxUtil;
|
|
|
use common\components\payUtil;
|
|
|
use Yii;
|
|
|
use common\components\util;
|
|
|
-use wkhtmltox\PDF\Converter as PDFConverter;
|
|
|
-use wkhtmltox\PDF\Object as PDFObject;
|
|
|
-use wkhtmltox\Image\Converter;
|
|
|
+use phpwkhtmltox\PDF\Converter as PDFConverter;
|
|
|
+use phpwkhtmltox\PDF\Object as PDFObject;
|
|
|
+use phpwkhtmltox\Image\Converter;
|
|
|
|
|
|
|
|
|
class TestController extends BaseController
|
|
|
@@ -40,30 +40,24 @@ class TestController extends BaseController
|
|
|
public function actionIp()
|
|
|
{
|
|
|
error_reporting(-1);
|
|
|
-
|
|
|
- // 设置画布宽度和高度
|
|
|
- $width = 400;
|
|
|
- $height = 400;
|
|
|
-
|
|
|
-// 创建一个空白的画布
|
|
|
- $image = imagecreatetruecolor($width, $height);
|
|
|
-
|
|
|
-// 从HTML文件中读取内容
|
|
|
- $html = file_get_contents('http://www.baidu.com');
|
|
|
-
|
|
|
-// 在画布上输出HTML内容
|
|
|
- imagestring($image, 5, 0, 0, $html, 0x000000);
|
|
|
-
|
|
|
-// 将画布保存为PNG格式图像
|
|
|
- imagepng($image, '/tmp/output.png');
|
|
|
-
|
|
|
-// 显示图像
|
|
|
- header('Content-Type: image/png');
|
|
|
- imagepng($image);
|
|
|
-
|
|
|
-// 释放画布资源
|
|
|
- imagedestroy($image);
|
|
|
-
|
|
|
+ phpinfo();
|
|
|
+// $ip = $_SERVER['SERVER_ADDR'] ?? '';
|
|
|
+// echo $ip;
|
|
|
+
|
|
|
+// $converter = new PDFConverter([
|
|
|
+// "out" => "test.pdf"
|
|
|
+// ]);
|
|
|
+// $converter->add(new PDFObject(
|
|
|
+// file_get_contents("http://www.google.co.uk")));
|
|
|
+// $converter->convert();
|
|
|
+
|
|
|
+ $c = new Converter(null, [
|
|
|
+ "fmt" => "png",
|
|
|
+ "in" => "https://www.baidu.com",
|
|
|
+ "out" => "test.png"
|
|
|
+ ]);
|
|
|
+ var_dump($c);
|
|
|
+ //$c->convert();
|
|
|
|
|
|
}
|
|
|
|