public function testInvalidTrinaryIsDecimal0()
 {
     $this->assertSame(0, toDecimal('13201'));
 }
예제 #2
0
function getGPS($image)
{
    if (!preg_match('/(\\.jpg|\\.jpeg)$/i', $image)) {
        return null;
    }
    $exif = exif_read_data($image, 0, true);
    if ($exif && @$exif['GPS']['GPSLongitude'][0]) {
        $lat = $exif['GPS']['GPSLatitude'];
        $lng = $exif['GPS']['GPSLongitude'];
        if (!$lat || !$lng) {
            return null;
        }
        // latitude values
        $lat_degrees = divide($lat[0]);
        $lat_minutes = divide($lat[1]);
        $lat_seconds = divide($lat[2]);
        $lat_hemi = $exif['GPS']['GPSLatitudeRef'];
        // longitude values
        $lng_degrees = divide($lng[0]);
        $lng_minutes = divide($lng[1]);
        $lng_seconds = divide($lng[2]);
        $lng_hemi = $exif['GPS']['GPSLongitudeRef'];
        $lat_decimal = toDecimal($lat_degrees, $lat_minutes, $lat_seconds, $lat_hemi);
        $lng_decimal = toDecimal($lng_degrees, $lng_minutes, $lng_seconds, $lng_hemi);
        return new Gps($lat_decimal, $lng_decimal);
    } else {
        return null;
    }
}
예제 #3
0
*/
$link = mysql_connect($rmConfig['dbhost'], $rmConfig['dbuser'], $rmConfig['dbpasswd']) or die('Could not connect: ' . mysql_error());
mysql_select_db($rmConfig['dbase']) or die('Could not select database');
if ($_GET["portions"] == "") {
    $portions = 0;
} else {
    $portions = $_GET["portions"];
}
$sql = 'insert into main (name, source, instructions, portions, type)values ("' . $_GET["recipe"] . '", "' . $_GET["source"] . '", "' . $_GET["instructions"] . '", ';
$sql .= $portions . ', ' . $_GET["recipe_type"] . ')';
//	echo "<br>SQL>  ".$sql;
mysql_query($sql) or die('Error:  ' . mysql_error());
$rindex = mysql_insert_id($link);
$ing_index = 0;
while (true) {
    // Add conversion to decimal in this loop for amt!!
    $insamt = toDecimal($_GET["amt" . $ing_index]);
    $lnk_insert = 'insert into links values (' . $rindex . ', ' . $_GET["ing" . $ing_index] . ', ' . $insamt . ', "' . $_GET["measure" . $ing_index] . '")';
    //		echo "<br>SQL>  ".$link_insert;
    mysql_query($lnk_insert) or die('Error:  ' . mysql_error());
    $ing_index++;
    if ($_GET["ing" . $ing_index] == "") {
        break;
    }
}
if ($_GET["keywords"] != "") {
    $sql = 'insert into keywords values (' . $rindex . ', "' . $_GET["keywords"] . '")';
    //		echo "<br>SQL>  ".$sql;
    mysql_query($sql) or die('Error:  ' . mysql_error());
}
echo 'Recipe submitted';
예제 #4
0
 public function testInvalidTrinaryIsDecimal0()
 {
     // $this->markTestSkipped();
     $this->assertSame(0, toDecimal('13201'));
 }