| _ \ _) | _ \ \ \ / -_) __/ _` | | \ ____| \___/ \_/ \___| _| \__,_| _| _| _| __ __| | \ \ / | | | \ -_) \ \ \ / \ _ \ | -_) _| _| _| \___| \_/\_/ _| _| \___/ _| \___| __| __ __| | _) ( _| _` | _ / | | | \ | \ _` | \___| _| \__,_| ___| \_, | _| _| _| _| _| _| \__, | ___/ ____/ Quind�o (Department) Jazz Animal Training Gondar Antioch (CA) Tianjin (municipality) Tangshan Arcadia (CA) Decatur (AL) Real Madrid F.C. Lille Flevoland Muscatine (IA)

«

»

Aug 29

Custom smilies


I use my own smilies around the web but I always forget the full link to the pics whenever I’m posting to a forum or whatever. I don’t need to remember them though as a long time ago I made the script below, saved it as index.php and put it in the folder where I hold my smilies… Now I just click a bookmark and open that page for a quick copy/paste. Feel free to use for your own uses, it’s essentially making a list of files in the directory and displaying them as per the html in the echo statements…

<script>
function SelectAll(element)
{
element.focus();
element.select();
}
</script>
<?php
    $path = getcwd() ;
    $dir_handle = @opendir($path) or die("Error opening $path");
    echo "<table style='text-align:center;font-family:sans-serif;'><tr><th>Image</th><th>Web Link</th><th>Forum Link</th><th>Image</th></tr>\n";
    while ($file = readdir($dir_handle)) {
	    if ("$file" != "." && "$file" != ".." && "$file" != "index.php") {
			echo "<tr><td><a href=\"http://the-kid.org/images/smilies/".htmlspecialchars(urlencode($file))." \"><img src=\"".htmlspecialchars(urlencode($file))."\" /></a></td>";
			echo "<td><input onClick=\"SelectAll(this);\" size=\"50\" type=\"text\" value=\"<img src='http://the-kid.org/images/smilies/".htmlspecialchars(urlencode($file))."'/>\" /></td>";
			echo "<td><input onClick=\"SelectAll(this);\" size=\"50\" type=\"text\" value=\"[img]http://the-kid.org/images/smilies/".htmlspecialchars(urlencode($file))."[/img]\" /></td>
			<td><a href=\"http://the-kid.org/images/smilies/".htmlspecialchars(urlencode($file))." \"><img src=\"".htmlspecialchars(urlencode($file))."\" /></a></td>
			</tr>\n";
    	}
    }
    echo "</table>";
    closedir($dir_handle);
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>