Replies: 15 comments
-
|
Beta Was this translation helpful? Give feedback.
-
It should work. I see: #!/usr/bin/luajit
local vips = require "vips"
local image = vips.Image.new_from_file(arg[1])
print("image width = " .. image:width()) Then:
|
Beta Was this translation helpful? Give feedback.
-
I use Lua driven by nginx instead of using Lua script directly. not #!/usr/bin/luajit |
Beta Was this translation helpful? Give feedback.
-
Sure, but for debugging you can try command-line tests. If they work, then your problem is probably in nginx. |
Beta Was this translation helpful? Give feedback.
-
To tell you the truth, I'm sure that there is no problem with the path. I can read the file normally in the command line, but in the nginx driver, use this function vips.Image.new_ from_ File will report an error. Finally, the problem is located in VIPs_ lib.vips_ foreign_ find_ Load debugging shows that the type of name is CDATA and the value is nil, that is, in local name = VIPs_ lib.vips_ foreign_ find_ The return value of the function in load (file name) is nil, but why is it empty? Before this function, I debugged that the file name is the correct path |
Beta Was this translation helpful? Give feedback.
-
vips.vips_ foreign_ find_ load The feeling is here |
Beta Was this translation helpful? Give feedback.
-
function Image.new_from_file(vips_filename, ...)
end |
Beta Was this translation helpful? Give feedback.
-
I guess you need to find at what point the filename vanishes. Sorry, I don't think I can help. |
Beta Was this translation helpful? Give feedback.
-
OK, thank you. I'll think about it again. Can I consider other reading methods. Or does it not support file reading in this way |
Beta Was this translation helpful? Give feedback.
-
It should work fine, I think you just have a small problem with nginx and strings. Add some more logging and try to discover exactly where your filename is disappearing. |
Beta Was this translation helpful? Give feedback.
-
I found out that VIPs is after this function_ foreign_ find_ Load, but I can't enter this function to debug |
Beta Was this translation helpful? Give feedback.
-
Only according to the source code you provide, you can only find this layer |
Beta Was this translation helpful? Give feedback.
-
You can debug that using gdb -- just put a breakpoint on |
Beta Was this translation helpful? Give feedback.
-
filename=/jpg/bg_2.jpg
I use
local image = vips.Image.new_ from_ file(filename)
however
vips/Image_ methods.lua:137 : VipsForeignLoad: "/jpg/bg_ 2.jpg" is not a known file format
the type(name)is cdata
Explain that the problem is
vips_ foreign_ find_ load
So what's the problem?
Beta Was this translation helpful? Give feedback.
All reactions