captcha.lua 670 B

123456789101112131415161718192021222324252627282930313233
  1. -- captcha.lua
  2. local captcha = {}
  3. captcha.__index = captcha
  4. --[[
  5. 创建一个新的 fw_captcha 对象
  6. @return 返回一个新的 fw_captcha 对象
  7. ]]
  8. function captcha.new(db)
  9. local instance = setmetatable({}, captcha)
  10. if db == nil then
  11. instance.module = fw_captcha.new()
  12. else
  13. instance.module = db
  14. end
  15. return instance
  16. end
  17. --[[
  18. 生成验证码
  19. @param width 宽度
  20. @param height 高度
  21. @param length 长度
  22. @param filepath 输出文件
  23. @return 验证码
  24. ]]
  25. function captcha:make(width, height, length, filepath)
  26. return self.module:make(width, height, length, filepath)
  27. end
  28. return captcha