Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
keffee
@kee
Member
NO. 11113 / 2014-01-16

[email protected]
13 Topics / 51 Replies
0 Followers
1 Following
20 Favorites
No GitHub.
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • Sidekiq Enqueued 里只有 1 个任务为什么不执行呢? at February 19, 2014

  • 如何用 carrierwave 把已有的文件传到 store (云端)?? at February 18, 2014

    @bydmm 用

    @photo.image = File.open(extract_output_path) @photo.save

    把提取的图片遍历执行上述操作(会重新上传一次到 cache 再到 server,创建 documents),图片一多耗时会很长,即便异步也有点累赘

  • 如何用 carrierwave 把已有的文件传到 store (云端)?? at February 18, 2014

    railscasts 找到案例了 谢谢回复

  • sidekiq log 疑惑? at February 18, 2014

    是因为指派了一个不存在的 queue "high" 导致 perform 不执行 在 c 或 m 里测试好了,再移到 worker 即可 thx for reply

  • carrierwave:清空 public/uploads/tmp 后,再上传文件不会在存储到这里了?? at February 18, 2014

    https://github.com/carrierwaveuploader/carrierwave 有关 Large files 段(上边引用的),我是否理解错了?? 改为 move_to = true,会否增加上传耗时?

    def move_to_cache
        true
      end
      def move_to_store
        true
      end
    
  • carrierwave:清空 public/uploads/tmp 后,再上传文件不会在存储到这里了?? at February 18, 2014

    By default, CarrierWave copies an uploaded file twice, first copying the file into the cache, then copying the file into the store. For large files, this can be prohibitively time consuming.

    这里写 copy twice,我上传时注意了下 public/photos/tmp 目录,显示生成了 cache 然后传到 server 接着 cache 删除了(是 move 吧?)

    我在 uploader 里添加

    def move_to_cache
        true
      end
      def move_to_store
        true
      end
    

    cache 就保留下来了,但是 wiki 里是这样

    When the move_to_cache and/or move_to_store methods return true, files will be moved (instead of copied) to the cache and store respectively.

    @ruby_sky 如果默认是 copy 那 cache 不应改清掉,设置 move_to = true 反而表面上让我感觉是 copy? 请简单描述下 CarrierWave 上传流程(文件 -》cache -》server?) cc @Martin91

  • 如何用 carrierwave 把已有的文件传到 store (云端)?? at February 17, 2014

    @birdfrank 按下实现了转化后图片的上传,怎么异步来执行 def extract_images 呢??我安装了 sidekiq

    # pdfmodel
    after_create :extract_images
    def extract_images
      # extract
      @photo = self.photos.new
      @photo.image = File.open(extract_output_path)
      @photo.save
    end
    
  • 如何用 carrierwave 把已有的文件传到 store (云端)?? at February 17, 2014

    感觉现在逻辑也可行

    # pdfuploader
    after :cache, :docsplit
    def docsplit
      # convert images output cache pach
    end
    # doc model
    field :images, :type => Array, :default => [] 
    mount_uploader :file, PdfUploader
    
    # docs c
    def create
      @doc.images = # 取出uploads cache路径下所有images
      @doc.save
    end
    

    @bydmm @doc.images = file_path 即可吗?上传时给的是FILE

  • 如何用 carrierwave 把已有的文件传到 store (云端)?? at February 17, 2014

    @birdfrank 同上, 现在 convert_images 是在 pdfUploader 里 after:cache 做的,此时还没有@doc.save(看到 after:store 后 carrierwave 把 cache 删掉了,就只有 store(七牛)里有 ppt 文件了)

  • 如何用 carrierwave 把已有的文件传到 store (云端)?? at February 17, 2014

    我是想把用户上传的 ppt 转成图片显示给访问 在 uploader 类里

    after :cache, :docsplit 
    def docsplit 
      # extract images
      Docsplit.extract_images()
      # move to store
    end
    

    cc @Rei @bydmm

  • 如何用 carrierwave 把已有的文件传到 store (云端)?? at February 17, 2014

    @bydmm 服务器生成的 PDF,XML 之类 想通过 carrierwave 上传文件到 store 的逻辑移到七牛

    user.avatar = you_file #这个只有文件路径,而且多个文件,怎么处理?是否直接用carrierwave部分逻辑更直接?
    @user.save
    
  • 如何用 carrierwave 把已有的文件传到 store (云端)?? at February 17, 2014

    carrierwave 把文件移到 store,没有现成的方法可用吗? @Rei

  • 如何用 carrierwave 把已有的文件传到 store (云端)?? at February 17, 2014

    @birdfrank sorry,没说清楚。是有 gem 的,已经安装,可以上传然后 cache 到 store(七牛) 我是想把服务器生成的文件也 move_to store 里,carrierwave 有没有现成的方法??

  • Rails 上传大的文件 at February 16, 2014

    @zqalyc 呃,carrierwave 考虑到大文件上传,可以关闭 cache store

    def move_to_cache
      false
    end
    
  • Peatio (貔貅) 电子加密货币交易所准备开源并征集内测用户 at February 16, 2014

    [email protected]

  • carrierwave:清空 public/uploads/tmp 后,再上传文件不会在存储到这里了?? at February 16, 2014
    def cache!(new_file) 
    107         new_file = CarrierWave::SanitizedFile.new(new_file)                                                                
    108   
    109         unless new_file.empty?
    110           raise CarrierWave::FormNotMultipart if new_file.is_path? && ensure_multipart_form                                
    111   
    112           with_callbacks(:cache, new_file) do
    113             self.cache_id = CarrierWave.generate_cache_id unless cache_id                                                  
    114   
    115             @filename = new_file.filename   
    116             self.original_filename = new_file.filename                                                                     
    117   
    118             if move_to_cache
    119               debugger   #调试进到这里,但cache_path = true,这里是否应该是路径str?  
    120               @file = new_file.move_to(cache_path, permissions)
    121             else           
    
    
  • carrierwave:清空 public/uploads/tmp 后,再上传文件不会在存储到这里了?? at February 16, 2014

    @Martin91 应该不是,几天前的我才刚清掉,没理由刚上传的 tmp 里就没有吧?

  • carrierwave:清空 public/uploads/tmp 后,再上传文件不会在存储到这里了?? at February 16, 2014

    By default, CarrierWave copies an uploaded file twice, first copying the file into the cache, then copying the file into the store.

    @ericguo 这里说的就是啊,我没动过 code,没设置过

    def move_to_cache
      true
    end
    

    我就是把 public/uploads/tmp 清空了

  • sidekiq run in background?? at January 24, 2014

    thx bros,受限于 redis 版本,升级为 2.13.1 后,有了 daemon,问题 fixed

  • sidekiq run in background?? at January 24, 2014

    sidekiq-2.5.3

  • sidekiq run in background?? at January 24, 2014

    @jjym 怎么说,请直接给出命令吧

  • Prev
  • 1
  • 2
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English