MyBB Community Forums

Full Version: Random Avatar.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok ive managed to make this:
http://dotmrt.nixhoster.net/randomimage.php

Can you please tell me how to put this .php file as my avatar, so users can see a random avatar whenever they visit my profile or see my posts. (REFRESH THE LINK TO SEE THE RESULT)

Please Reply.
What script did you use?? Putting it in [img] tags doesn't work so something seems to be wrong with it.
Well, there is a plugin for this. I dunno how to use yours but there is a plugin for random avatars.
The problem with your script is that it sends the image tag <img src="blah"> instead of the actual image data. Sending the data would allow you to use it in most cases.
better show us a technique you used
should be done like that:
		header('Content-type: image/png');
$img = imageCreateFromPNG('http://www.yoursite.com/signature.php');
		ImagePng ($img);
		ImageDestroy ($img);
<?php 

/* 
 * Name your images 1.jpg, 2.jpg etc. 
 * 
 * Add this line to your page where you want the images to  
 * appear: <?php include "randomimage.php"; ?> 
 */  

// Change this to the total number of images in the folder 
$total = "8"; 

// Change to the type of files to use eg. .jpg or .gif 
$file_type = ".png"; 

// Change to the location of the folder containing the images 
$image_folder = "images/random"; 

// You do not need to edit below this line 

$start = "1"; 

$random = mt_rand($start, $total); 

$image_name = $random . $file_type; 

echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />"; 

?>

This is what ive used. Please tell what to do.
Use this: http://community.mybboard.net/thread-457...#pid316732

It's so much simpler, you don't need to add the names of the images to the file, just specify the path to the folder the images are in, and they will go into the cycle. This is the script I use for mine. If I want to add new images, I just upload them, no need to edit the file.
Thx m8 Toungue
That php file rocks!