<?PHP
function sliceit($file_name)
{
	global $counter, $title;
	$img = imagecreatefrompng($file_name);
	// assuming that $img holds the image with which you are working
	$img_width  = imagesx($img);
	$img_height = imagesy($img);
	if ($img_height > 1000)
	{
		// New image size
		$width  = $img_width;
		$height = floor($img_height/2);
	
	
	
		$im1 = imagecreatetruecolor($width, $height);
		$im2 = imagecreatetruecolor($width, $height);
		imagecopy($im1, $img, 0, 0, 0, 0, $width, $height);
		imagecopy($im2, $img, 0, 0, 0, $height, $width, $height);
		
		// Then output or save the $img file
		imagepng($im1, "$title/$counter.png");
		$counter++;
		imagepng($im2, "$title/$counter.png");
		imagedestroy($im1);
		imagedestroy($im2);
		
	}
	imagedestroy($img);
}
$title='Questionable Content dot net';
$start_page='http://questionablecontent.net/view.php?comic=1';
$next_page="<li><a href=\"view.php\?comic=([0-9]+?)\">Next<\/a><\/li>";
$before_next="http://questionablecontent.net/view.php?comic=";
$detect_img='<img id="strip" src=".\/comics\/([0-9]+?\.png)"><\/a>';
$before_img='http://questionablecontent.net/comics/';
$how_many_per_page=1;
$counter=0;
$after_func='sliceit';
?>