MyBB Community Forums

Full Version: Random Avatar - error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
<?php 

header("Content-type: image/png");
 
 

$avatars[] = "forums/images/avatars/1.png"; 
$avatars[] = "forums/images/avatars/2.png"; 
$avatars[] = "forums/images/avatars/3.png"; 
$avatars[] = "forums/images/avatars/4.png"; 
$avatars[] = "forums/images/avatars/5.png"; 

$avatar = $avatars[mt_rand(0, count($avatars)-1)]; 

$newavatar = imagecreatefrompng($avatar); 
imagepng($newavatar); 
imagedestroy($newavatar); 

?>

What I did wrong to get this message when I refresh the page?
A imagem “http://computerandstuff.co.cc/avatar.php” contém erros e não pode ser exibida.
Assuming that error says what I think it does, the imagecreatefrompng() function isn't available, you'll need to ask your host about it.
LOL sorry:
The image "http://computerandstuff.co.cc/avatar.php" contains errors and can not be displayed.

But if I reload the page the avatar shows normally...
It (the error) happens only sometimes.