<commit_before><?php
/*
Returns JSON object containing all the info of an image

Author: <NAME>
Url: http://denbeke.be
Date: September 2013
*/


require_once(dirname(__FILE__).'/../core/urania.php');

//Parse the arguments
if(!isset($_GET['image'])) {
	throw new exception("No arguments provided");
}
$image = intval(htmlspecialchars($_GET['image']));
$outputImage;

//Get the image
try {

	$u = new Urania(dirname(__FILE__).'/../core/config.php');
	$outputImage = new imageExif($u->getImage($image));
	$outputImage->readExifFromFile();
	

}
catch(exception $exception) {
	echo $exception;
}

//Return the json object
$output = array();

$output['name'] = $outputImage->getName();
$output['fileName'] = $outputImage->getFileName();
$output['date'] = date('d-m-Y', $outputImage->getDate());

$output['shutterSpeed'] = $outputImage->getShutterSpeed();
$output['aperture'] = $outputImage->getAperture();
$output['iso'] = $outputImage->getIso();
$output['focallength'] = $outputImage->getFocalLength();
$output['camera'] = $outputImage->getCamera();

$output['longitude'] = $outputImage->getGpsLongitude();
$output['latitude'] = $outputImage->getGpsLatitude();

echo json_encode($output);

?><commit_msg>Exception handling in ajax call getImage<commit_after><?php
/*
Returns JSON object containing all the info of an image

Author: <NAME>
Url: http://denbeke.be
Date: September 2013
*/


require_once(dirname(__FILE__).'/../core/urania.php');

$output = array();


try {


	//Parse the arguments
	if(!isset($_GET['image'])) {
		throw new exception("No arguments provided");
	}
	$image = intval(htmlspecialchars($_GET['image']));
	$outputImage;


	//Get the image
	$u = new Urania(dirname(__FILE__).'/../core/config.php');
	$outputImage = new imageExif($u->getImage($image));
	$outputImage->readExifFromFile();
	

	//Return the json object
	$output = array();
	
	$output['name'] = $outputImage->getName();
	$output['fileName'] = $outputImage->getFileName();
	$output['date'] = date('d-m-Y', $outputImage->getDate());
	
	$output['shutterSpeed'] = $outputImage->getShutterSpeed();
	$output['aperture'] = $outputImage->getAperture();
	$output['iso'] = $outputImage->getIso();
	$output['focallength'] = $outputImage->getFocalLength();
	$output['camera'] = $outputImage->getCamera();
	
	$output['longitude'] = $outputImage->getGpsLongitude();
	$output['latitude'] = $outputImage->getGpsLatitude();
	
	$output['error'] = false;
	
	echo json_encode($output);
	

}
catch(exception $exception) {

	$output['error'] = true;
	echo json_encode($output);
	
}





?>
{'fraction_non_alphanumeric': 0.20368916797488226, 'fraction_numerical': 0.0031397174254317113, 'mean_word_length': 5.926630434782608, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3164653', 'n_tokens_mistral': 880, 'n_tokens_neox': 841, 'n_words': 161}