All pastes #764272 Raw Edit

Something

public text v1 · immutable
·published 2007-11-07 02:00 UTC
rendered paste body
<?php

function ListImages($dir)
{
	if($search = opendir($dir))
	{
		while(false !== ($file = readdir($search)))
		{
			if(preg_match("/.(?:jpe?g|png|gif)$/", $file))
				$ImageList[] = $file;
		}

		return $ImageList;
	}
}

function DisplayImage($Image, $Size)
{
	if(!(file_exists("/home/pawnstick/www/img/$Image...$Size")))
	{
		$NewThumb = ResizeImage("/home/pawnstick/www/img/$Image", $Size);
		imagejpeg($NewThumb, "/home/pawnstick/www/img/$Image...$Size");
	}

foreach(ListImages($dir) as $img)
     DisplayImage($img, 150);
?>