ruby-on-rails – 如何用载波创建第一页pdf页面的缩略图
发布时间:2020-12-16 22:08:54 所属栏目:百科 来源:网络整理
导读:我以这种方式处理PDF文件的缩略图: version :thumb do process :resize_to_limit = [260,192] process :convert = :jpg process :set_content_type end def set_content_type(*args) self.file.instance_variable_set(:@content_type,"image/jpeg") end 但
我以这种方式处理PDF文件的缩略图:
version :thumb do process :resize_to_limit => [260,192] process :convert => :jpg process :set_content_type end def set_content_type(*args) self.file.instance_variable_set(:@content_type,"image/jpeg") end 但是当PDF文件是多页面时,它会生成一个jpg文件中所有页面的缩略图. 解决方法
我今年早些时候提交了一个
patch这样做.使用自定义处理器:
def cover manipulate! do |frame,index| frame if index.zero? end end process :cover (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |