Location: PHPKode > projects > RabbitBB - Online Web Storage Project > mywebdrive/PHP_CON/imageprocess/BSGetThumb.php
<?PHP

class BSGetThumb
{
	var $webappcfg;
	function BSGetThumb()
	{
		global $webappcfg;
		$this->webappcfg = $webappcfg;
	}

	function getthumb($_request, $_response)
	{
		// $webappcfg['thumbsize']

		if (isset($_request['fileid']))
		{
			$daogf = new DAOGetFileDirAttr();
			$filedirdb = $daogf->getFileById($_request['fileid']);
			if ($filedirdb==null)
			{
				$_response['result'] = false;
				$_response['error'] = "FILEDIRDBNULL";
				return $_response;
			}
			if (!isset($_request['towidth']))
				$_request['towidth'] = $this->webappcfg['thumbsize'][0];
			if (!isset($_resquest['toheight']))
				$_request['toheight'] = $this->webappcfg['thumbsize'][1];
			$_request['constraint'] = true;
			$_request['imglist'] = array();

			$tobj = $filedirdb->getobj();
			$_request['imglist'][0]['filename'] = 
				$this->webappcfg['filestorage']. "/" .
				$tobj->getlocation();
			$_request['imglist'][0]['contenttype'] =
				$tobj->getcontenttype();
			$_request['imglist'][0]['filedirdb'] = $filedirdb;

			$bsri = new BSResizeImage();
			$_response = $bsri->resizeimage($_request, $_response);

			if ($_response['result'][0] ==true)
			{
				$_response['result'] = true;
				$tfile = fopen($_response['resizedimglist'][0]['filepath'], "r");
				$_response['resizedimglist'][0]['filesize'] =
					filesize($_response['resizedimglist'][0]['filepath']);
				$_response['resizedimglist'][0]['filecontent'] =
					fread($tfile, $_response['resizedimglist'][0]['filesize']);
				fclose($tfile);
			}

			return $_response;

		}
	}
}
Return current item: RabbitBB - Online Web Storage Project