找回密码
 快速注册
搜索
楼主: hbghlyj

Asymptote测试

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-2-19 04:34
hbghlyj 发表于 2024-2-18 18:55
用同样的方法利用https://quickchart.io/documentation/graphviz-api/可以使论坛支持GraphViz ...
graphviz论坛可以直接在您的帖子中由 DOT 源代码生成 DOT 图表

例如在帖子中写
[dot]digraph {a -> b}[/dot]
然后得到:
a a b b a->b

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2024-2-27 19:19

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-2-27 20:39


看來錯出在上游,我們這邊没法做任何事
ERROR: invalid optimizer module

点评

只能暂时改成 png 图了,画质差点总比没有强  发表于 2024-2-27 21:18

3

主题

452

回帖

6188

积分

积分
6188
QQ

显示全部楼层

爪机专用 发表于 2024-2-27 20:46
hbghlyj 发表于 2024-2-27 20:39
看來錯出在上游,我們這邊没法做任何事
ERROR: invalid optimizer module

有没有替代方案?
I am majia of kuing

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-2-27 22:32

可以在服務器上安裝TeXLive和Asymptote,像我的網站一樣

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2024-2-27 22:57
hbghlyj 发表于 2024-2-27 22:32
可以在服務器上安裝TeXLive和Asymptote,像我的網站一樣


你的网站装了?那可以改为将链接连接到你的服务器传回图片吗?(我一窍不通……

点评

但那邊用的是canvas不是圖片,不能直接连接,需修改……  发表于 2024-2-27 23:37

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-2-28 16:06
hbghlyj 发表于 2023-2-18 12:22
检查这个svg发现它内含一个base64的jpg
Asymptote三维图不能输出矢量图, 只能输出位图.

在3D圖,SVG不如PNG,因為base64更長,下載更慢吧

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2024-2-28 16:26
本帖最后由 kuing 于 2024-2-28 16:37 编辑 asymptote.ualberta.ca 这个在线的还能用吗?我这边就输入一个 import venn; 点 Run 都报错

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2024-2-29 14:58
hbghlyj 发表于 2024-2-27 23:07
我們先等等,不做任何操作,也許過一陣子就好了😀

果然等等就好了😁
楼上的在线链接也能正常使用了

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2024-11-7 21:44
又挂了……原因不明,啥也没改……

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-11-11 04:51
本帖最后由 hbghlyj 于 2024-11-11 12:37 编辑
kuing 发表于 2024-11-7 13:44
又挂了……原因不明,啥也没改……

reqbin.com 測試:
服務器的響應竟然什麼內容都沒有!只有HTTP 标头,沒有任何內容:
Screenshot 2024-11-11 123445.png
Content是空的:
Screenshot 2024-11-11 123656.png

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2024-11-11 11:11

但是 asymptote.ualberta.ca 还是好用的,只是发送出了问题?你研究一下呗,用你的网站测试一下

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-11-11 18:02
kuing 发表于 2024-11-11 03:11
但是 asymptote.ualberta.ca 还是好用的,只是发送出了问题?你研究一下呗,用你的网站测试一下 ...
编写简短的 php 脚本进行测试

  1. <?php
  2. $url = 'http://asymptote.ualberta.ca:10007?f=pdf&render=4';
  3. $data = 'import teapot;';
  4. $options = [
  5.     'http' => [
  6.         'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
  7.         'method'  => 'POST',
  8.         'content' => $data,
  9.     ],
  10. ];
  11. $context  = stream_context_create($options);
  12. $result = file_get_contents($url, false, $context);
  13. file_put_contents('teapot.pdf', $result);
  14. ?>
复制代码
成功得到輸出 teapot.pdf,沒有問題!

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-11-11 18:08
这次和上次不同,上次故障出现在上游,只需等待即可,而这次上游工作正常,我想等待并不能解决问题。

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

kuing 发表于 2024-11-11 20:01
hbghlyj 发表于 2024-11-11 18:02
编写简短的 php 脚本进行测试

成功得到輸出 teapot.pdf,沒有問題!

目前本站的 /asy/index.php 的代码为
  1. <?php
  2. if(empty($_GET['format'])){$f='svg';}
  3. //if(empty($_GET['format'])){$f='png';}
  4. elseif($_GET['format']=='svg'||$_GET['format']=='png'||$_GET['format']=='html') {$f=$_GET['format'];}
  5. $url = "http://asymptote.ualberta.ca:10007?f=".$f;
  6. if(isset($_GET['code'])){
  7. $curl = curl_init($url);
  8. curl_setopt($curl, CURLOPT_URL, $url);
  9. curl_setopt($curl, CURLOPT_POST, true);
  10. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  11. $headers = array(
  12.    "Content-Type: text/plain",
  13. );
  14. curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  15. curl_setopt($curl, CURLOPT_POSTFIELDS, $_GET['code']);
  16. $resp = curl_exec($curl);
  17. curl_close($curl);
  18. if($f=='svg'){header( 'Content-type: image/svg+xml' );}
  19. if($f=='png'){header("Content-Type: image/png");}
  20. print($resp);
  21. }
  22. ?>
复制代码

应该怎么改?

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-11-11 20:16
kuing 发表于 2024-11-11 12:01
目前本站的 /asy/index.php 的代码为

应该怎么改?


我原样在本地(Windows) 执行,竟沒出錯!
Screenshot 2024-11-11 121625.png

您也可測試一下,把文件命名為Untitled-1.php,本地(Windows)運行
  1. c:\php\php-cgi.exe Untitled-1.php code="import venn;" f="svg"
复制代码
我這邊是正常的

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-11-11 20:20
kuing 发表于 2024-11-11 12:01
目前本站的 /asy/index.php 的代码为

应该怎么改?


是不是上游把infinityfree禁了

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-11-11 20:24
kuing 发表于 2024-11-11 12:01
目前本站的 /asy/index.php 的代码为

应该怎么改?
建議測試一下,InfinityFree编译完的PHP有沒有设置支持cURL 扩展?否則curl_exec這些都無效了

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-11-11 20:25

如何检查 curl 是否已启用或禁用

  1. echo function_exists('curl_version');
复制代码

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

 楼主| hbghlyj 发表于 2024-11-11 21:38
本帖最后由 hbghlyj 于 2024-12-13 16:35 编辑

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 12:29

Powered by Discuz!

× 快速回复 返回顶部 返回列表