简体   繁体   English

CarrierWave 和 MySQL

[英]CarrierWave and MySQL

How would you install carrierwave and mysql together, I can't find anything in the documentation.您如何将carrierwave和mysql一起安装,我在文档中找不到任何内容。 The only way I can see is to install paperclip, then migrate to carrierwave.我能看到的唯一方法是安装回形针,然后迁移到carrierwave。

UPDATE: To be more specific, store the image in a BLOB in the database.更新:更具体地说,将图像存储在数据库中的 BLOB 中。

if you include RMagick, you can use the to_blob method that it provides: http://studio.imagemagick.org/RMagick/doc/image3.html#to_blob如果包含 RMagick,则可以使用它提供的 to_blob 方法: http://studio.imagemagick.org/RMagick/doc/image3.html#to_blob

What problems are you encountering?你遇到什么问题?

You need to have both carrierwave and mysql in your gemfile and bundled - did you follow the tutorial here您需要在 gemfile 中同时包含carrierwave 和 mysql 并捆绑在一起 - 您是否按照此处的教程进行操作

Follow the intructions to create uploader, create a migration to add an image string to your model and you'll be all fine.按照说明创建上传器,创建迁移以将图像字符串添加到 model 中,一切都会好起来的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM