Location: PHPKode > scripts > User IMG API > cms-images-api-master/src/api/imagesapi.php
<?php
/* 

	CMS User Avatars API version 1rev0
	
	Made by JacobCZ in 2013
	
	Please credit me, when using this. If you do, you are permitted to use within your script, if you do not, you are not permitted to use it.
	
	Used technologies: Plain PHP!
	
	Please read comments before editing the code!
	
	Published under GPL v3!
	
*/

/*

	Usage --> You must edit a configuration first!
	
	Every user file must match his username and be in choosen format (you can change this by editing configuration).
	
	After that, just include this file in your site and display the image by calling the avatar(); function.

*/

//Function for displaying avatar with username parameter.
function avatar($username) {
	//CONFIG HERE!!
	
	/*
	
		Relative path to your images folder FROM FILE, WHERE IS USED! Not from here! 
		
		For example: avatar(); is in index.php, and your images are in uploads/images folder, you put here uploads/images/, (you MUST add the slash on the end!)
		nothing else!
	
	*/
	$place = "uploads/images/";
	
	/*
	
		Filetype (extension) of your images, for example png, jpg, gif etc.
		
		Write in .extension format! For example .png not just png!
	
	*/
	$extension = ".png";
	
	//Definition of address DO NOT CHANGE THIS!
	$address = $place . $username . $extension;
	
	//Making script recognise empty username and saing it! You can change only the text in echo!
	if(!$username) {
		//You can change this
		echo "Please insert username!";
		//But do not change this!
		return 0;
	}
	else {
		//Calling function that will insert the image, do not touch!
		avatarInsertion($address);
	}
	
}
//Do not touch me!
function avatarInsertion($address) { ?>

	<img src="<?php echo $address; ?>" /> <br />

<?php
}

//Little "easter egg" for inserting minecraft skins to page! Just use mcSkin(username);
function mcSkin($ign) {
	//Address for fetching skins, do not change!
	$address = "http://s3.amazonaws.com/MinecraftSkins/" . $ign . ".png";
	
	if(!$ign) {
		//This text appears when username isn't specified! You can change it...
		echo "Please insert username!";
		
		//But do not change this!
		return 0;
	}
	else {
		//Calling function that will insert the image, do not touch!
		skinInsertion($address);
	}
}

//Image insertion function.
function skinInsertion($address) { ?>

	<img src="<?php echo $address; ?>" /> <br />
	
<?php }
Return current item: User IMG API