compress and upload upyun success
This commit is contained in:
@@ -7,7 +7,8 @@ server {
|
||||
|
||||
set $tmp_file_dir "/usr/local/file_upload"; # 文件存储路径
|
||||
set $task_server "http://127.0.0.1:8080"; # task server host
|
||||
set $htyuc "http://127.0.0.1:3000"; #htyuc host
|
||||
# set $htyuc "http://127.0.0.1:3000"; #htyuc host
|
||||
set $htyuc "https://admin.alchemy-studio.cn"; #htyuc host
|
||||
set $resty_loc "/usr/local/opt/openresty";
|
||||
set $convert "/usr/local/bin/convert";
|
||||
set $upyun_operator "moicen";
|
||||
@@ -60,6 +61,10 @@ server {
|
||||
location /api/ngx/image/form_upload_to_combine {
|
||||
content_by_lua_file $resty_loc/nginx/scripts/form_upload_to_combine.lua;
|
||||
}
|
||||
#compress image file by form
|
||||
location /api/ngx/image/form_upload_to_compress {
|
||||
content_by_lua_file $resty_loc/nginx/scripts/form_upload_to_compress.lua;
|
||||
}
|
||||
#Upload image files to combine by wx
|
||||
location /api/ngx/image/wx_upload_to_combine {
|
||||
content_by_lua_file $resty_loc/nginx/scripts/wx_upload_to_combine.lua;
|
||||
|
||||
@@ -109,6 +109,11 @@ local function read_form_file()
|
||||
handle:close()
|
||||
|
||||
-- Upload compressed file to upyun
|
||||
local upyun_upload = require("lib.upyun_upload")
|
||||
|
||||
ngx.log(ngx.INFO, 'UPLOAD COMPRESSED IMAGE -> fullpath -> ', output_file[i])
|
||||
|
||||
upyun_upload.upload(output_file[i], nil)
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,11 @@ function upyun_upload.upload(filepath, filename)
|
||||
filename = strip_path.strip_path(filepath)
|
||||
end
|
||||
|
||||
ngx.log(ngx.INFO, 'bucket -> ', bucket)
|
||||
ngx.log(ngx.INFO, 'directory -> ', directory)
|
||||
|
||||
local savePath = bucket .. "/" .. directory .. "/" .. filename
|
||||
ngx.log(ngx.INFO, " savePath " , savePath)
|
||||
|
||||
local info, err = upyun:upload_file(savePath, nil, nil)
|
||||
if not info then
|
||||
|
||||
Reference in New Issue
Block a user