function savePhoto(dirname, image) {

	//test(dirname, image);
	
	isUpdated(dirname, image).then(function(result) {

		if(result == true) {
			console.log('salvam si imaginea');
			var fileName = getDate() + '.png';

			cs.getFile('screenshots/' + dirname + '/' + fileName, {create: true, exclusive: true}, function() {
				console.log('am creat fisierul ' + fileName);
				cs.write('screenshots/' + dirname + '/' + fileName, 'image/png', image, {create: false});
			});

		} else {
			console.log('page is not updated');
		}

	});
}
/**
*	Saves a photo in a directory if the image is different than the image we took last visit
* @param: dirname - directory where we want to save the photo
* @param: image - base64 encoded image that we want to save
*/
Saves a photo in a directory if the image is different than the image we took last visit
Saves a photo in a directory if the image is different than the image we took last visit
function savePhoto(dirname, image) {
	isUpdated(dirname, image).then(function(result) {
		if(result == true) {
			console.log('salvam si imaginea');
			var fileName = getDate() + '.png';
			cs.getFile('screenshots/' + dirname + '/' + fileName, {create: true, exclusive: true}, function() {
				console.log('am creat fisierul ' + fileName);
				cs.write('screenshots/' + dirname + '/' + fileName, 'image/png', image, {create: false});
			});
		} else {
			console.log('page is not updated');
		}
	});
}
function savePhoto ( dirname , image ) { isUpdated ( dirname , image ) . then ( function ( result ) { if ( result == true ) { console . log ( 'salvam si imaginea' ) ; var fileName = getDate ( ) + '.png' ; cs . getFile ( 'screenshots/' + dirname + '/' + fileName , { create : true , exclusive : true } , function ( ) { console . log ( 'am creat fisierul ' + fileName ) ; cs . write ( 'screenshots/' + dirname + '/' + fileName , 'image/png' , image , { create : false } ) ; } ) ; } else { console . log ( 'page is not updated' ) ; } } ) ; }
Saves a photo in a directory if the image is different than the image we took last visit
Saves a photo in a directory if the image is different than the image we took last visit
//test(dirname, image);