MyBB Community Forums

Full Version: Imgur Plugin weird code modification issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I modified the plugin file of the imgur plugin, because I don´t want my users to be redirected to the black imgur website with the pic, but only to to the image itself on a blank white page.
By copying the url of the enlarged picture from the stock imgur webpage one gets redirected to, after clicking on a uploaded image in the forum, I found out that the specific url is just with a the subdomain "i." in front.
So it added this i. to the code (5th line) of the plugin file:

var code = "";
                                if (dsize!="r") {
                                    pos = link.lastIndexOf(".");
                                    if (dlink==1) {
                                        code = "[url="i. + link + "][img]" + link.substring(0, pos) + dsize + link.substring(pos) + "[/img][/url]";
 
But when I click on a freshly uploaded image in my forum now, I still get the black standard imgur website with the image.
Now comes the funny part. As soon as I´ve copied the url of the image itself and visited it in a tab, my forum will also load the images with a blank background.
Why the hell is it doing that and how can I modify the code to always show the users the image on the white page?
Try this:
link = link.replace('imgur.com','i.imgur.com');
code = "[url="+ link + "][img]" + link.substring(0, pos) + dsize + link.substring(pos) + "[/img][/url]";

If it doesn't work try this:
link = link.replace('imgur.com','i.imgur.com');
code = "[url="+ link + ".png][img]" + link.substring(0, pos) + dsize + link.substring(pos) + "[/img][/url]";
Where should I put it?