aa7gzg
Last Updated: February 25, 2016
·
470
· gouravtiwari
Febcde7f09d486161ab6b3180c8b85c7

Save image in resources

Save image in resources directory with 'bubble-wrap':

imageData = UIImage.UIImageJPEGRepresentation(@image_view.image, 1)
encodedData = [imageData].pack("m0")
data = {"image" => encodedData }
unpack = data["image"].unpack("m0")
@image_name = Time.now.to_s.gsub(/:|-| /,'')

File.open("#{App.resources_path}/#{@image_name}.jpg", "w+b") do |f|
  f.write(unpack.first)
end
Say Thanks
Respond