lib/imgur.rb
# Uploads an image from local disk
#
# @param [String] image_filename The filename of the image on disk to upload
# @raise [ImgurError]
# @return [Hash] Image data
Uploads an image from local disk
Uploads an image from local disk
def upload_file image_filename
			c = Curl::Easy.new("http://imgur.com/api/upload.json")
			c.multipart_form_post = true
			c.http_post(Curl::PostField.content('key', @api_key), Curl::PostField.file('image', image_filename))
			response = Crack::JSON.parse c.body_str
			raise ImgurError, response["rsp"]["error_msg"] if response["rsp"]["stat"] == "fail"
			response["rsp"]["image"]
		end
def upload_file image_filename c = Curl :: Easy . new ( "http://imgur.com/api/upload.json" ) c . multipart_form_post = true c . http_post ( Curl :: PostField . content ( 'key' , @api_key ) , Curl :: PostField . file ( 'image' , image_filename ) ) response = Crack :: JSON . parse c . body_str raise ImgurError , response [ "rsp" ] [ "error_msg" ] if response [ "rsp" ] [ "stat" ] == "fail" response [ "rsp" ] [ "image" ] end
Uploads an image from local disk
Uploads an image from local disk
None
Hash
None
image_filename
<not_specific>
<not_specific>
image_filename The filename of the image on disk to upload
image_filename The filename of the image on disk to upload