<?
class images extends action
{
	function save_addimage($insert_arr)
	{
		$this->db->addRecord($this->db->db_pre."images",
			$insert_arr	
		);	
	}

	function delimage_ajax()
	{
		$image_id	=	(int)$_GET['image_id'];
		$result	=	$this->del_img($image_id);	
		if($result){
			echo json_return('ok');
			exit;
		}	
	}

	function del_img($image_id)
	{
		$image_res	=	$this->db->getRecord("SELECT * FROM {$this->db->db_pre}images WHERE image_id='".$image_id."'");
		if($image_res){
			@unlink(UPLOAD_DIR.$image_res['image_path']);
			@unlink(UPLOAD_DIR.$image_res['image_thumb_path']);
			$result			=	$this->db->deleteRecord($this->db->db_pre."images"," image_id='".$image_id."'");	
		}
		return $result;		
	}
} 

