File: smileyfilegenerator.php

package info (click to toggle)
achims-guestbook 2.52-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 956 kB
  • ctags: 714
  • sloc: php: 4,821; sh: 56; makefile: 38
file content (35 lines) | stat: -rw-r--r-- 1,136 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
	# You can start this script with your browser to generate a smileys.php automatically if you have really much smiley pictures. 
	
	
	$output = fopen("smileys.php", "w") or die ("Can't create smileys.php!");

	fputs($output, "<?php\n");
	fputs($output, "\$smileylist = array(");
	
	$count = 1;
	$handle = opendir('gif'); 
	while (false !== ($file = readdir($handle))) { 
		if ($file != "." &&
				$file != ".." &&
				$file != "bg.gif" &&
				$file != "test.gif") { 
	  	if (preg_match("/([0-9_a-z])*(?i).(gif|jpg|png)(?i)/", $file, $number)) {
	  		echo "-> working on: gif/".$file."...<BR>";
	  		$size = GetImageSize("gif/$file");
	  		
	  		if ($count == 1) fputs($output, "\"".$count."\" => \"<IMG SRC=gif/".$file." BORDER=0 WIDTH=".$size[0]." HEIGHT=".$size[1]." ALT=\\\"\\\">\",\n");
	  		else fputs($output, "                    \"".$count."\" => \"<IMG SRC=gif/".$file." BORDER=0 WIDTH=".$size[0]." HEIGHT=".$size[1]." ALT=\\\"\\\">\",\n");
	  		$count++;
	  	} 
	  } 
	}
	closedir($handle);
	
	echo "-> done!";
	
	fputs($output, ");\n");
	fputs($output, "?>");
	
	fclose($output);
?>