Skip to content

Instantly share code, notes, and snippets.

@loganrice loganrice/uploader
Created May 30, 2015

Embed
What would you like to do?
convert pdf to png
# encoding: utf-8
class VehicleUploader < CarrierWave::Uploader::Base
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
version :to_png do
process :convert_to_single_png
def convert_to_single_png
manipulate! do |img|
img.append.format('PNG')
img
end
end
def filename
change_ext(super, 'PNG') if original_filename
end
def change_ext(file, ext_new)
file.chomp(File.extname(file)) + '.' + ext_new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.