module FDimageBase64
Public Class Methods
new(data)
click to toggle source
# File lib/fdimage/fdimage_base64.rb, line 2 def initialize(data) if check_base_64(data) data = Base64.decode64(data) @image = MiniMagick::Image.read(data) end end
Private Instance Methods
check_base_64(str)
click to toggle source
# File lib/fdimage/fdimage_base64.rb, line 10 def check_base_64(str) str =~ /^([A-Za-z0-9+\/]{4})*([A-Za-z0-9+\/]{4}|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)$/ end