<?php
include_once("class/class.MySQL.php");
require 'class/resizeImage.php';
$db	=new MySQL();

	if(isset($_FILES['profile-image']['name']) && $_FILES['profile-image']['name']!=''){
		$randnum		=rand(1200156,9994564569);
		$image			=$randnum.$_FILES['profile-image']['name'];
		$data['photo'] = $image;
		
		

		$paththumb= "upload/thumb/".$randnum.$_FILES['profile-image']['name'];
		$pathimg= "upload/image/".$randnum.$_FILES['profile-image']['name'];
		
		try {
	
				$image = new ImageResize($_FILES['profile-image']['tmp_name']);
				
				//// Save thumb
				$image->resizeToWidth(250);
				$image->save($paththumb);
				
				/// Save Image
				$image1 = new ImageResize($_FILES['profile-image']['tmp_name']);
				$image1->resizeToWidth(500);
				$image1->save($pathimg);

		} catch (Exception $e) {

		}
		//echo $$data2['photo'];
		$where['e_id'] = $_POST['e_id'];
		$db->Update('file',$data,$where);
		echo $data['photo'];
		}


?>