Return to Snippet

Revision: 38029
at December 22, 2010 20:05 by hamsterbacke82


Initial Code
<?php 
$handle=opendir("img");

$i = 0;
while (($file = readdir($handle))!==false) {
	
	$imagesizes = getimagesize('img/'.$file);
	$width = $imagesizes[0];
	$height = $imagesizes[1];

	echo "	<td><a href=\"javascript:EmotionsDialog.insert('$file','$file-0');\"><img src=\"img/$file\" width=\"$width\" height=\"$height\" border=\"0\" alt=\"{#$file-0}\" title=\"{#$file-0}\" /></a></td>"."\n";
	if( $i%4 == 0 ) {
		echo '</tr>';
	}
	if( ($i+4)%4 == 0 ) {
		echo '<tr>'."\n";
	}

	$i++;
}

closedir($handle);
 ?>

Initial URL


Initial Description
run this from plugins/emotions and copy/paste the output to emotions.htm

Initial Title
Parse files in a directory and output list (example: tinymce emoticons/emotions)

Initial Tags
php, files

Initial Language
PHP