PHP code example of rpunnett / extract_imgur

1. Go to this page and download the library: Download rpunnett/extract_imgur library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rpunnett / extract_imgur example snippets


use  Imgur\Imgur;

$url = 'http://imgur.com/4Bpn7iO'

#Checks if the link is from imgur, returns true false : TRUE
Imgur::valid($url); 

#Returns the ID of the image : 4Bpn7iO
Imgur::getId($url); 

#Returns the TYPE of the link -> Album, Gallery, Hash, Image : Image
Imgur::getType($url); 

#Returns an array of URLs based on requested type
Type Options:
* original
* imgur_page
* small_square
* large_thumbnail

Imgur::getImage($url,'original');
/* For a gallery
url		[3]
0   :   http://i.imgur.com/x3Opkpv.jpg
1   :   http://i.imgur.com/oXLVTyT.jpg
2   :	http://i.imgur.com/1cbsAEZ.jpg
--- For an image
url [1]
0   :	http://imgur.com/4Bpn7iO
*/