MyBB Community Forums

Full Version: [1.8] How add imgur upload button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
I just realized it may've been because I was using WAMP offline (i was hella tired and encoding a load of clips last night) I'll give it another go later when i have some free time.
Doesn't work for me and video button broken too.
Can somebody give me his bbcodes_sceditor.js? (without the imgur key of course?)
I'm using mybb 1.8.1
https://drive.google.com/file/d/0B8t35P-...8tTEk/view

here is your required File . @Yadomi
(2014-11-14, 12:36 PM)mujeebdgk Wrote: [ -> ]https://drive.google.com/file/d/0B8t35P-...8tTEk/view

here is your required File . @Yadomi

Working 100% now, thanks very much.
Thanks bro, but it says "undefined" ?

edit: ok i solved thx.
Martec, the test user for us to preview the imgur addon is returning an error? Maybe someone changed the pass?

I was thinking of adding this, but I am getting an error on the upload - "undefined"- I just wanted to check I had applied the changes correctly, but the user is not available.
(2014-12-02, 09:08 AM)Leefish Wrote: [ -> ]Martec, the test user for us to preview the imgur addon is returning an error? Maybe someone changed the pass?

I was thinking of adding this, but I am getting an error on the upload - "undefined"- I just wanted to check I had applied the changes correctly, but the user is not available.

because not activate account is deleted in 3 days...

use this thread forum.minnasuki.com/thread-2732.html
User: test2
pass: test789
Martec, I have been working further on this and after a tip from Destroy666 I have found a way to apply the changes in the codebutton template.

This is the code I used:

In code buttons template after the below code but BEFORE the ending script tag add the imgur code block

FIND:
{$editor_language}
$(function() {
	$("#{$bind}").sceditor(opt_editor);

	MyBBEditor = $("#{$bind}").sceditor("instance");
	{$sourcemode}
});

Add AFTER but inside the </script> tag

IMGUR CODE BLOCK
$.sceditor.command.set("imgur", {
    _imgur: function() {
        document.querySelector("textarea").insertAdjacentHTML("afterEnd", '<input class="imgur" style="visibility:hidden;position:absolute;top:0;" type="file" onchange="upload(this.files[0])" accept="image/*">');
        document.querySelector("input.imgur").click();
    },
    exec: function() {
        $.sceditor.command.get("imgur")._imgur();
    },
    txtExec: function() {
        $.sceditor.command.get("imgur")._imgur();
    },
    tooltip: "Upload to Imgur"
});

function upload(a) {
    if (!a || !a.type.match(/image.*/)) return;
    document.body.className = "uploading";
    var b = document.querySelector(".sceditor-button-imgur div");
    b.className = b.className + " imgurup";
    var c = new FormData();
    c.append("image", a);
    var d = new XMLHttpRequest();
    d.open("POST", "https://api.imgur.com/3/image.json");
    d.onload = function() {
        var a = "[img]" + JSON.parse(d.responseText).data.link + "[/img]";
        $('#message, #signature, textarea[name*="value"]').data("sceditor").insert(a);
        var b = document.querySelector(".sceditor-button-imgur div.imgurup");
        b.className = b.className - " imgurup";
        document.querySelector("input.imgur").remove();
    };
    d.setRequestHeader("Authorization", "Client-ID xxxx");
    d.send(c);
}
Imgur button is working fine with me , but today i want to know that , every time when we update mybb version , we again have to edit these files to working imgur button , is there any permanent solution ? mean when we update mybb version then it shouldn't be change . Smile hope i clear my point
Hi, imgur button works perfectly, but images uploaded from users don't appear in my album (public).

Is there a way to "connect" my album to imgur button?

So I can have images uploaded from users in my forum on my public album and maybe I can get a image gallery.

Thank you
Pages: 1 2 3 4 5