Imgur – Free Image CDN | HackerRahul

imgur banner

Hey guys, CDN’s are popular nowadays because of their fast servers and reliability and most importantly it’s load time. So as you all know that CDN cost too much, but there are some free ones too but they are slow and not reliable. So today I am having a website named IMGUR, Most of you already know this website as it allowed free unlimited space to every user and you can upload as many images as you want both openly and anonymously (that’s great right?).

Demo Download

So first of all,

What is Imgur?

It’s free image hosting platform, in which you can upload, share and vote other’s pics. It also provides API for developers to use it as an image hosting platform.

What is the limit of daily uploads?

There is no limit at all. In fact, there is no space limit, unlike any other CDN. So you can upload as many images gifs as you want.

So let’s get started,

imgurt register app

Select Oauth 2 authorization without callback URL and enter email and description and fill captcha and click submit.

  • Now you will be given client id and client secret like this below.

Write down client id for the next step.

  • Now you have to authorize this application.authorization imgur

https://api.imgur.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&response_type=token

  • Just replace YOUR_CLIENT_ID from URL given above and visit this URL in your browser, and you will see this.

  • Just click allow and proceed.
  • Now go to https://imgur.com/account/settings/apps and edit redirect and replace the current redirect to¬†https://YOUR_IMGUR_USERNAME.imgur.com (Like mine is https://hackerrahul.imgur.com).
  • And you are done.

Now let’s get some hands dirty on codes.

So I’ve created a special function which is ready to implement in any of your projects.

Just replace YOUR_APP_CLIENT_ID with your app id.

so we can upload images, gifs and mp4 video up to 5 sec in imgur by just calling upload_image(); function.

So upload_image() function need 2 parameters

  1. path of the folder where an image is going to be uploaded temporarily.
  2. The image which you are uploading.

here is an example of uploading an image to imgur

You can see the demo above and see the working example of imgur.

I hope you like this tutorial. Please subscribe to my blog and youtube channel.

Thanks.