imgur

uploading a file to imgur via python

£可爱£侵袭症+ 提交于 2019-12-22 08:23:21
问题 I'm having trouble uploading an image to Imgur using the python requests module and the Imgur API. My code is the following: import base64 import json import requests from base64 import b64encode client_id = 'my-client-id' headers = {"Authorization": "Client-ID my-client-id"} api_key = 'my-api-key' url = "http://api.imgur.com/3/upload.json" j1 = requests.post( url, headers = headers, data = { 'key': api_key, 'image': b64encode(open('1.jpg', 'rb').read()), 'type': 'base64', 'name': '1.jpg',

uploading a file to imgur via python

不打扰是莪最后的温柔 提交于 2019-12-22 08:22:02
问题 I'm having trouble uploading an image to Imgur using the python requests module and the Imgur API. My code is the following: import base64 import json import requests from base64 import b64encode client_id = 'my-client-id' headers = {"Authorization": "Client-ID my-client-id"} api_key = 'my-api-key' url = "http://api.imgur.com/3/upload.json" j1 = requests.post( url, headers = headers, data = { 'key': api_key, 'image': b64encode(open('1.jpg', 'rb').read()), 'type': 'base64', 'name': '1.jpg',

Imgur API Version 3 JavaScript upload example

不想你离开。 提交于 2019-12-20 08:39:23
问题 All the examples I find online are of earlier versions of the Imgur API or non JS code all of which uses an API key which doesn't exist in the newer API. Instead you get a client_id and secret . Anyone have example code that shows how an image can be uploaded to Imgur through JavaScript (or jQuery) using version 3 of their API? 回答1: $.ajax({ url: 'https://api.imgur.com/3/image', headers: { 'Authorization': 'Client-ID YOUR_CLIENT_ID' }, type: 'POST', data: { 'image': 'helloworld.jpg' },

imgur api won't work

旧城冷巷雨未停 提交于 2019-12-19 10:26:29
问题 i have a question about the imgur api. I want to create a gallery for my website using the imgur api, but how can i create a file uploader that uploads to the imgur servers? Here is what i created: <?php include 'xmlparser.php'; // From http://www.criticaldevelopment.net/xml/doc.php if($_SERVER['REQUEST_METHOD'] == "POST"){ $data = file_get_contents($_FILES["file"]['tmp_name']); // $data is file data $pvars = array('image' => base64_encode($data), 'key' => HERE_MY_API_KEY); $timeout = 30;

Upload image on imgur with php

假装没事ソ 提交于 2019-12-14 04:03:12
问题 Trying to make script which uploading image on imgur anonymously. Just blank page when I run it. I need to post image(in base 64 string format) with title and description. Sorry for my english and code. <? header ("Content-type: image/png"); $im = ImageCreate (200, 100); $couleur_fond = ImageColorAllocate ($im, 255, 0, 0); $client_id="d9514d92012b55a"; $pvars = base64_encode($im); $timeout = 30; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'https://api.imgur.com/3/image.json'); curl

Trouble sending a file to Imgur

自古美人都是妖i 提交于 2019-12-13 12:17:37
问题 I'm trying to use the python requests lib to upload an image to Imgur using the imgur api. The api returns a 400, saying that the file is either not a supported file type or is corrupt. I don't think the image is corrupt (I can view it fine locally), and I've tried .jpg , .jpeg , and .png . Here is the code: api_key = "4adaaf1bd8caec42a5b007405e829eb0" url = "http://api.imgur.com/2/upload.json" r = requests.post(url, data={'key': api_key, 'image':{'file': ('test.png', open('test.png', 'rb'))}

Simple Java Imgur Upload

ⅰ亾dé卋堺 提交于 2019-12-13 08:51:39
问题 I am trying to upload an image to Imgur using their API with a Java web application. I have copy-pasted this guy's code from Imgur API uploading . My method seems to run "successfully" but I don't think anything is happening. I get no feedback other than BUILD SUCCESS and am not sure how to get feedback (errors). I am willing to spend a lot of time to get this to work but am wondering if someone can start me out by suggesting why my current implementation doesn't seem to work? I made a plain

Using Retrofit with Imgur's API

混江龙づ霸主 提交于 2019-12-13 01:46:54
问题 I'm attempting to use the Retrofit library with Imgur's API with no success. I keep receiving 403 Permission Denied errors. The only authorization Imgur uses for what I'm attempting to do is through a header, which I (believe) I am doing correctly. My current code is the following: package me.rabrg.imgur; import me.rabrg.imgur.response.Image; import me.rabrg.imgur.service.ImageService; import retrofit.RequestInterceptor; import retrofit.RestAdapter; public class ImgurApi { private final

How can I get imgur.com album images using ajax request

元气小坏坏 提交于 2019-12-12 15:25:51
问题 I used this code : (function($){ var albumID = 'NNbeO'; var albumAPI = "https://api.imgur.com/3/album/" + albumID + "/images"; $.ajax({ url: albumAPI, headers:{ 'Authorization':'xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }, type: 'GET', dataType: 'json', success: function(data) { alert(data.data[0].link); }, error: function() { console.log("ERRORZ"); } }); })(jQuery); But I got this error : { "data": { "error": "Malformed auth header", "request": "\/3\/album\/NNbeO\/images", "method": "GET" }

How do I upload to an imgur user's account

回眸只為那壹抹淺笑 提交于 2019-12-12 09:03:09
问题 I am able to upload anonymous images to imgur using the api like this: public static void UploadImage() { Image image = GetImage(); string base64 = Util.ImageToBase64(image); using (WebClient client = new WebClient()) { client.Headers.Add("Authorization", "Client-ID " + clientID); NameValueCollection data = new NameValueCollection(); data["image"] = base64; data["type"] = "base64"; byte[] responsePayload = client.UploadValues("https://api.imgur.com/3/image/", "POST", data); string response =