Location: PHPKode > scripts > FXLake effect > fxlake-effect/example.php
<?php
/*
+-------------------------------------------------+
+                                                 +
+    FXLake.class.php ver. 1.0 by László Zsidi    +
+      CGI binary version on http://gifs.hu       +
+                                                 +
+    This class can be used and distributed       +
+    free of charge, but cannot be modified       +
+        without permission of author.            +
+                                                 +
+  Try on-line animated FXLake effect generator   +
+                                                 +
+     http://phpclasses.gifs.hu/demos/FXLake/     +
+                                                 +
+-------------------------------------------------+
*/

include "FXLake.class.php";

if ( $dh = opendir("images/" ) ) {
	while ( false !== ( $dat = readdir ( $dh ) ) ) {
		if ( $dat != "." && $dat != ".." ) {
			if ( ( substr ( $dat, 0, 10 ) + ( 15 * 60 ) ) <= time ( ) ) {
				unlink ( "images/$dat" );
			}
		}
	}
	closedir ( $dh );
}

if ( isset ( $_POST [ 'upload' ] ) ) {
	if ( $_FILES [ 'image' ] [ 'type' ] == "image/gif" ) {
    	$GIF = fread ( fopen ( $_FILES [ 'image' ] [ 'tmp_name' ], "rb" ),
    							filesize ( $_FILES [ 'image' ] [ 'tmp_name' ] ) );
		for ( $i = ( 13 + 3 * ( 2 << ( ord ( $GIF_frame { 10 } ) & 0x07 ) ) ), $j = FALSE, $k = TRUE; $k; $i++ ) {
			switch ( $GIF { $i } ) {
				case "!":
					if ( ( substr ( $GIF, ( $i + 3 ), 8 ) ) == "NETSCAPE" ) {
						$j = TRUE;
					}
					break;
				case ";":
					$k = FALSE;
					break;
			}
		}
		if ( $j ) {
			$err = "Hey, this image is an animated image.";
		}
		else {
			$id = time ( );
        	$effect = new FXLake ( $GIF, 12, "bin" );
        	fwrite ( fopen ( "images/$id.gif", "wb" ), $effect->AnimatedOut ( ) );
		}
	}
	else {
		$err = "Accept GIF images only.";
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<link rel="stylesheet" type="text/css" href="index.css">
	<?php
		if ( $err ) {
			print "<script type=\"text.javascript\">window.onload = function ( ) { alert ( '$err' ); }</script>\n";
		}
	?>
	</head>
	<form method="post" action="index.php" enctype="multipart/form-data">
		<table width=200 cellpadding=10 cellspacing=0 border=0>
			<tr>
				<td align=center colspan=2><span class="str"><b>Animated Water Reflection Effect Generator</b></span></td>
			</tr>
			<tr>
				<td align=center class="td_0">
					<input type="hidden" name="MAX_FILE_SIZE" value=250000 />
					<input type="submit" name="upload" value="Create" />
				</td>
				<td align=center class="td_0">
					<input type="file" name="image" size=45 />
				</td>
			</tr>
			<tr>
				<?php
					if ( file_exists ( "images/$id.gif" ) ) {
						print "<td align=center colspan=2><img src=\"images/$id.gif\" alt=\"\" border=0></td>\n";
					}
				?>
			</tr>
		</table>
	</form>
</html>
Return current item: FXLake effect