添加bimg
This commit is contained in:
@@ -5,12 +5,12 @@ local API_URL = "http://newgmapi.liulikeji.cn/api/sanjuuni"
|
||||
local INPUT_URL = "https://git.liulikeji.cn/xingluo/CCTweaked-Demo/raw/branch/main/Demo/SanjuuniApi-Demo/demo.jpg"
|
||||
|
||||
|
||||
local function Get_image_url(INPUT_URL,API_URL,width,height)
|
||||
local function Get_image_url(INPUT_URL,API_URL,args,output_format)
|
||||
-- ===== 1. 发送HTTP请求 / Send HTTP request =====
|
||||
local requestData = {
|
||||
input_url = INPUT_URL,
|
||||
args = { "-8","--width="..width,"--height="..height }, -- sanjuuni转换参数 / sanjuuni conversion args
|
||||
output_format = "lua"
|
||||
args = args,
|
||||
output_format = output_format
|
||||
}
|
||||
|
||||
local response, err = http.post(
|
||||
@@ -34,17 +34,24 @@ local function Get_image_url(INPUT_URL,API_URL,width,height)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- 图片宽度 / Image width
|
||||
local width, height = term.getSize() -- 获取终端尺寸(width=宽度,height=高度)
|
||||
local width = width * 2 -- 宽度×2
|
||||
local height = height * 3 -- 高度×3
|
||||
|
||||
-- 转换参数 / Conversion parameters
|
||||
args = { "-8","--width="..width,"--height="..height }
|
||||
output_format = "lua"
|
||||
|
||||
local download_url = Get_image_url(INPUT_URL,API_URL,width,height)
|
||||
-- 调用API / Call API
|
||||
local download_url = Get_image_url(INPUT_URL,API_URL,args,output_format)
|
||||
|
||||
|
||||
-- ===== 显示图片 / Display image =====
|
||||
-- 下载图像文件 / Download image file
|
||||
print("\nConversion successful! Download URL:")
|
||||
print(download_url)
|
||||
|
||||
luafile = http.get(download_url)
|
||||
if luafile then
|
||||
print("\nLua file downloaded successfully.")
|
||||
|
||||
Reference in New Issue
Block a user