grails - 像 Grails 中的图像这样的二进制文件的最佳数据类型是什么?

标签 grails groovy binaryfiles

我想知道为我当前工作的 grails 项目的二进制文件(可能是图像)选择最佳数据类型的最佳实践。我考虑过 byte[]。非常感谢您的建议。

谢谢!

最佳答案

我同意@tim_yates,byte[] 是你的选择,如果你将它持久化到数据库,你应该添加一个映射:

class SomePersistent {
   byte[] image

   static mappings = {
      image type: "blob"
   }
}

(未编译,语法可能略有不同,请查看 Grails 手册)

关于grails - 像 Grails 中的图像这样的二进制文件的最佳数据类型是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11289268/

相关文章:

grails - 在createCriteria的域对象的collection属性上是否存在 'contains'功能?

javascript - 如何将JavaScript变量传递给g:remoteFunction的 “update”属性?

jenkins - Jenkins 管道构建失败后如何发送 Slack 通知?

grails - 如何强制grails下载csv文件?

grails - 如何在 Grails Geb/Spock 测试用例中获取 sessionFactory?

servlets - 注释掉grails 2.4项目的web.xml中异步支持的影响是什么?

grails - 错误 连接被拒绝 : Grails email verification using mail plugin

mp3 - 了解 Mp3 文件结构

version-control - 在 TFS 源代码管理中更新二进制文件

c - 在 C 中转储结构