Forums > announcements >

Images are a thing now


2JJ1

CEO of Bugged Code Inc.

admin

Posts: 588

Threads: 25

Joined: Dec, 2016

Reputation: 27

Posted

Just like in Discord, an image URL will now automatically convert to an image during thread view.

 

The following is a Gyazo screenshot link:

 

 

Links ending in .png, .gif, and .jpeg will also work

 

Imgur links work as well, but as an embed. Unfortunately, I could not figure out how to extract the image from Imgur's presented link. How ever, you can copy the plain image link from Imgur and use that to display without the embed. All links must start with https.

YTBlog

PoopMaster

SoundInfinity

Posts: 122

Threads: 23

Joined: Jul, 2019

Reputation: 7

Replied

Yes sirr, now I can include my minion memes:

https://i.makeagif.com/media/7-01-2018/b4LOfG.gif

 

Proud creator of: WRD+

2JJ1

CEO of Bugged Code Inc.

admin

Posts: 588

Threads: 25

Joined: Dec, 2016

Reputation: 27

Replied

@PoopMaster That made me laugh wayyy too hard

YTBlog

YNW_Melly

#EndTheDrama

Posts: 359

Threads: 61

Joined: Nov, 2019

Reputation: -29

Replied

@2JJ1 YAY. Buying Patron also! :) Sending the email RN.

"I'm a king | No longer on WeAreDevs"

Posts: 7

Threads: 3

Joined: Mar, 2020

Reputation: 0

Replied

how do u do it ?

Z3STY

wearedevs.net/d/Fluxus

Posts: 135

Threads: 29

Joined: Sep, 2019

Reputation: 4

Replied

Hey Jon, I'm not sure if I read it correctly about imgur links, but if you mean getting the image from an imgur link like this for example:

 

https://imgur.com/2cBatac

All you need to do is change the url to "i.imgur.com" and add ".png" at the end like this:

HTTPS > i.imgur.com/2cBatac.png

Proud owner of Fluxus

Paid Exploits: SynapseX, Sirhurt, Sentinel

Discord: CLICK ME

2JJ1

CEO of Bugged Code Inc.

admin

Posts: 588

Threads: 25

Joined: Dec, 2016

Reputation: 27

Replied

@Z3STY That pattern doesn’t always work. Not every image is a png. There are .jpgs and .gifs.

YTBlog

Posts: 27

Threads: 2

Joined: Apr, 2020

Reputation: -20

Replied

I posted an image of a cookie

PoopMaster

SoundInfinity

Posts: 122

Threads: 23

Joined: Jul, 2019

Reputation: 7

Replied

@2JJ1

Alright, you probably found a better workaround, but I made this script for you:

 

 

[code]

function LoadImgurImage(url="", extensions=["png","gif"]){

    let getExtension = (from="", excludeDot=false)=>{

        let _temp = excludeDot ? from.match(/(.*?)[.](.*)$/) : from.match(/(.*?)([.].*)$/);

        return _temp ? _temp[_temp.length-1] : "";

    }; // ("hello.txt") -> .txt || ("hello.txt", true) -> txt

 

    return new Promise((resolve, reject)=>{

        let imageUrl = new URL(url); 

        let imageElement = new Image();

 

        // URL Conditions

        imageUrl.protocol = "https:"; // http: -> https:

        if(!imageUrl.hostname.startsWith("i."))

            imageUrl.hostname = `i.${imageUrl.hostname}`; // imgur.com -> i.imgur.com

 

        let extensionlessUrl = imageUrl.href.substring(0, imageUrl.href.length-getExtension(imageUrl.pathname).length);

        let extensionIndex = 0;

 

        function next(){

            if(extensionIndex < extensions.length){

                imageUrl.href = `${extensionlessUrl}.${extensions[extensionIndex]}`;

                imageElement.src = imageUrl.href;

                ++extensionIndex;

            } else {

                reject(new Error("Image failed to load."));

            }

        }

 

        // Events

        imageElement.addEventListener("load", (e)=>{

            resolve({

                Url: imageUrl.href,

                Element: imageElement,

                Extension: getExtension(imageUrl.href, true)

            });

 

            // If it doesn't have a parent, it probably won't be used afterwards.

            if(!imageElement.nodeParent) imageElement.remove();

        });

 

        imageElement.addEventListener("error", next);

        

        imageElement.src = imageUrl.href;

    });

}

 

// Usage

LoadImgurImage("https://imgur.com/2cBatac").then((data)=>{

    document.body.appendChild(data.Element); // Displays image

}).catch(console.log); // Failed to load

[/code]

 

(Imagine not having [code] support, wrd+ yes sirr!)

Proud creator of: WRD+

Posts: 8

Threads: 0

Joined: Apr, 2020

Reputation: 0

Replied

Hi can someone help me with downloading jj it says virus scan failed.