Location: PHPKode > projects > PHP-Comics > php-comics/view_image.php
<?php
	header('Content-type: image/jpg');
	include_once('inc/inc.php');

function SureRemoveDir($dir, $DeleteMe) {
	if(!$dh = @opendir($dir)) return;
	while (false !== ($obj = readdir($dh))) {
		if($obj=='.' || $obj=='..') continue;
		if(!@unlink($dir.'/'.$obj)) SureRemoveDir($dir.'/'.$obj, true);
	}

	closedir($dh);
	if($DeleteMe) {
		@rmdir($dir);
	}
}

SureRemoveDir(DB::Setting("CacheDirectory",0),false);
$comic = stripslashes(stripslashes(urldecode($_GET['comic'])));
$path = stripslashes(stripslashes(urldecode($_GET['path'])));
$comicname = $path .'/'. $comic;
$filename = urldecode(stripslashes($_GET['page']));
$cachepathname = img::extractfrombook($comicname,$filename,DB::Setting("CacheDirectory",0));
$outputimg = img::resize($cachepathname,$_GET['maxwidth']);	
imagejpeg($outputimg);
?>

Return current item: PHP-Comics