<?php
	include_once($_SERVER['DOCUMENT_ROOT'] ."/includes/info.php");
	include_once("/home/admin/includes/imagefunctions.php");

	if (isset($_REQUEST['img']))
	{
		$imgfile = urldecode($_REQUEST['img']);

		// Note getNewImage doesn't allow images larger than original, so no need to check size here
		$width = (isset($_REQUEST['w']) && is_numeric($_REQUEST['w'])) ? $_REQUEST['w'] : 0;
		$height = (isset($_REQUEST['h']) && is_numeric($_REQUEST['h'])) ? $_REQUEST['h'] : 0;

		if (strpos($imgfile,'http://')===false && strpos($imgfile,'https://')===false)
		{
			$imgpath =  $_SERVER['DOCUMENT_ROOT'] . $imgfile;
			if (!isImage($imgpath)) die;
		}
		else
		{
			$imgpath = $imgfile;
		}

		$image_type = @exif_imagetype($imgpath);

		if ($image_type && in_array($image_type, $supportedExifImageTypes))
		{
			header('Content-type: ' . image_type_to_mime_type($image_type));

			getNewImage($imgpath,"",$width,$height);
		}

	}
?>
