We've already got it for questions and answers. Let's get it for chat too! Most of my images come from screen captures so this would be really great!
-
15This is definitely on our list of things to do; we were mainly waiting on the code to stabilize before integrating it– Marc GravellCommented Mar 25, 2013 at 16:34
-
1Great to hear. I look forward to it!– SpartanDonutCommented Mar 25, 2013 at 16:58
-
Have some rep, Todders.– AlmoCommented May 11, 2013 at 18:39
-
@MarcGravell any update on this? I'm just curious / anxiously waiting :)– SpartanDonutCommented Aug 5, 2013 at 16:07
-
1@Todders did that not get done? Hmm... That's odd - will look into why... I thought we had them up to date with each other.– Marc GravellCommented Aug 5, 2013 at 17:22
-
@MarcGravell Not that I can tell. I look forward to hearing what you find out!– SpartanDonutCommented Aug 5, 2013 at 17:59
-
3@ToddersLegrande Now now, you don't reasonably expect something as complex as a picture upload script to become stable in a TINY little year do you??!?!– MickLHCommented Feb 25, 2014 at 19:26
-
@MarcGravell Mick makes a good point. No rush on this. Sorry for being so impatient.– SpartanDonutCommented Feb 25, 2014 at 19:29
-
1@MarcGravell Any update? This's integrated into the main site, but not chat. I find it a pain to save it to the desktop and then browse through all of my files and folders with the upload dialog to add an image in chat. As a moderator, this would be greatly appreciated.– Anonymous PenguinCommented Apr 4, 2014 at 21:39
-
4Can we either get an ETA or a status as why this hasn't been done yet? It sounded like it was planned to be implemented but hasn't been. I hate to nag but I feel plenty of time has passed for me to question this again. Thank you!– SpartanDonutCommented Jun 19, 2014 at 20:24
-
2I am in agreement with Spartan here. @MarcGravell is there any update on this?– PipCommented Apr 7, 2015 at 20:55
-
4@MarcGravell "we were mainly waiting on the code to stabilize before integrating it" - Has the code stabilized? Can the wait be over?– Jason CCommented May 6, 2017 at 15:38
-
I recently added drag and drop and paste from clipboard for images to Chat Dark Theme Plus chrome extension. Might be worth looking at for short-term solutions.– rlemonCommented Jan 29, 2018 at 14:08
2 Answers
Well for the time being I've signed up for the imgur api and created a tampermonkey / userscript for this. My code is included below.
If you use this make sure you update the URL you want to use this on as well as your own API key.
Once you have this running on the chat room you wish to use it in it is simply a matter of clicking in the text box and pasting in image data. This script probably has flaws due to the fact that I just put it together based on several blogs and being a complete newbie to how userscripts work, etc. but it fits my needs for now.
// ==UserScript==
// @name tehimgur
// @namespace http://chat.stackexchange.com/rooms/19/game-development
// @version 0.1
// @match http://chat.stackexchange.com/rooms/19/game-development
// ==/UserScript==
function upload(file) {
if (!file || !file.type.match(/image.*/)) return;
document.body.className = "uploading";
var text = document.getElementById("input").value
document.getElementById("input").value = "Uploading...";
var fd = new FormData();
fd.append("image", file);
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://api.imgur.com/3/upload.json");
xhr.onload = function () {
var link = JSON.parse(xhr.responseText).data.link;
document.getElementById("input").value = text + link;
}
xhr.setRequestHeader('Authorization', 'Client-ID YOUR-CLIENT-ID-HERE');
xhr.send(fd);
}
/* Handle paste events */
function pasteHandler(e) {
if (e.clipboardData) {
var items = e.clipboardData.items;
if (items) {
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf("image") !== -1) {
var blob = items[i].getAsFile();
upload(blob);
}
}
}
}
}
document.getElementById("input").addEventListener("paste", pasteHandler);
-
Additionally, make sure your redirect URL is set to imgur.com (https) in your imgur app settings Commented Dec 12, 2014 at 17:38
Can we do this without a dialog and a button ... just have the chat window accept image file drops or something ... would be much cooler :)