FTP access your server and make a folder "emotes"
Copy the spare, extra emotes up into the folder.
If you like to order them in a non-haphazard manner, rename the emoticons, using a,b,c etc to create order.
The directory listing will be alphanumeric.
Eg, two smiley faces might be a_smiley1.gif and a_smiley2.gif, followed by two frowny faces, b_frown1.gif and b_frown2.gif.
Write this file, we could call it "oldemotesdisplaychat.php" and upload to your main chat folder.
- Code: Select all
<?php
echo "<span style=style11>";
function dirImages($dir) {
$d = dir($dir); //Open Directory
while (false!== ($file = $d->read())) //Reads Directory
{
$extension = substr($file, strrpos($file, '.')); // Gets the File Extension
if($extension == ".jpg" || $extension == ".jpeg" || $extension == ".gif" |$extension == ".png") // Extensions Allowed
$images[$file] = $file; // Store in Array
}
$d->close(); // Close Directory
asort($images); // Sorts the Array
return $images;
}
$array = dirImages('emotes');
$i=0;
foreach ($array as $key => $image) {
if ($i%14==0){
echo '<div class="row">';
}
echo "<img src=emotes/" . $image . " border=0 onClick="pfc.insert_text('[em]emotes/" . $image . "[/em]', '', false)"> ";
if ($i%14==13 || $i==count( $array )-1) {
echo '</div>';
}
$i++;
}
echo "</span>";
?>
Then in the chat.js.tpl.php, around lines 1600 or 1700, in the general parse message area, add:
- Code: Select all
// other emotes
rx = new RegExp('\[em\](.+?)\[/em\]','ig');
msg = msg.replace(rx, '<img src="$1">');
How you call the file is up to you, but what I've done is added a button, with a rollover, and on click to display a hidden div.
You could have several emoticon boxes of course, for emoticons of different sizes
enjoy