Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class FileUploader < CommonUploader
  2. def extension_whitelist
  3. %w[pdf]
  4. end
  5.  
  6. def cover
  7. manipulate! do |image|
  8. image.format('png', 0) do |c|
  9. c.fuzz '3%'
  10. c.trim
  11. c.colorspace 'sRGB'
  12. end
  13. image
  14. end
  15. end
  16.  
  17. version :preview do
  18. process :cover
  19. process convert: :png
  20. process resize_to_fit: [200,200]
  21.  
  22. def full_filename (for_file = model.source.file)
  23. super.chomp(File.extname(super)) + '.png'
  24. end
  25. end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement