Skip to content

Instantly share code, notes, and snippets.

@devmanhinton
Created December 17, 2013 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devmanhinton/8000650 to your computer and use it in GitHub Desktop.
Save devmanhinton/8000650 to your computer and use it in GitHub Desktop.
#decode base64
Dir.mkdir('decoded_photos/')
Dir.foreach('./photos') do |item|
next if !item.match(/.*_signature_image/)
base64_encoded = File.read("photos/" + item)
decocded = Base64.decode64(base64_encoded.split(',')[1])
File.open("decoded_photos/#{item}.png", 'wb') do |file|
file.write(decocded)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment