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
Written by Gourav Tiwari
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Bubble-wrap
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#