PhpSnip.com

User Stats

Publish all images of a directory automatically. Add title, description, home-link

Publish all images of a directory automatically. Add title, description, home-link. Exclude files of your choice.

Info

 Download  View Source (print view)
 Rating : 4.7  Views : 339

Source Code ( 23 lines )

// This file publish.php publishes all files of the specified directory straight, or into a table
// remove comments and unnecessary lines
$home="http://tkom.ch";		// path absolute or relative to the homesite
$path="./images/images/";	// path absolute or relative to the directory of this file or the file where this file is included to.
							// this directory must contain ONLY the images you want to be published (on background images or buttons etc.)

$folder = dir($path);
// leave the echo statement out if you don't need font definitions, title or explanations
echo"<font face='Courier New, Courier, mono' size='+3' color='#FF6633'>
<h3>TITLE</h3></font>
<p>Explanations shown above the pictures<p><a href='./publish_all_image_files_of_directory.zip'>Download script</a><p>";
	// <table> // into table --> below comments
		while($file=$folder->read())
		{
		
		if ($file !="." and $file !=".." and $file !="WS_FTP.LOG") // adapt if you want to exclude other files
			// echo"<tr><td><img src="$path$file"></td></tr>";   // into table (table shown only after all images are loaded!)
			echo"<img src="$path$file">&nbsp";  // replace this line by above line if you want to publish into a table
		}
	// </table> // into table --> above comments
	$folder->close();
echo"<p><a href='$home' target='_parent'>HOME</a></font>";
?>

Search

Subscribe

  Rss Feeds

Sponsors

Advertise