Skip to content

Commit

Permalink
make gps data only required for inscription image issue openbenches#160
Browse files Browse the repository at this point in the history
  • Loading branch information
mike committed Jul 4, 2018
1 parent c2d1b9e commit 75a52ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions www/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@
$benchID = insert_bench($lat,$lng, $inscription, $userID);

// Save the Image
save_image($_FILES['userfile1'], $media_type, $benchID, $userID);
$error_message .= save_image($_FILES['userfile1'], $media_type, $benchID, $userID, true);

// Save other images
if ($_FILES['userfile2']['tmp_name'])
{
$sha1 = sha1_file($_FILES['userfile2']['tmp_name']);
save_image($_FILES['userfile2'], $_POST['media_type2'], $benchID, $userID);
$error_message .= save_image($_FILES['userfile2'], $_POST['media_type2'], $benchID, $userID);
$mediaURLs[] = "https://{$domain}/image/{$sha1}/1024";
}
if ($_FILES['userfile3']['tmp_name'])
{
$sha1 = sha1_file($_FILES['userfile3']['tmp_name']);
save_image($_FILES['userfile3'], $_POST['media_type3'], $benchID, $userID);
$error_message .= save_image($_FILES['userfile3'], $_POST['media_type3'], $benchID, $userID);
$mediaURLs[] = "https://{$domain}/image/{$sha1}/1024";
}
if ($_FILES['userfile4']['tmp_name'])
{
$sha1 = sha1_file($_FILES['userfile4']['tmp_name']);
save_image($_FILES['userfile4'], $_POST['media_type4'], $benchID, $userID);
$error_message .= save_image($_FILES['userfile4'], $_POST['media_type4'], $benchID, $userID);
$mediaURLs[] = "https://{$domain}/image/{$sha1}/1024";
}

Expand Down
9 changes: 6 additions & 3 deletions www/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

function get_twitter_details(){
session_start();
return array("bob", "bobbobertson");

\Codebird\Codebird::setConsumerKey(ADMIN_CONSUMER_KEY, ADMIN_CONSUMER_SECRET);
$cb = \Codebird\Codebird::getInstance();
Expand Down Expand Up @@ -280,12 +281,14 @@ function get_place_name($latitude, $longitude) {
return htmlspecialchars($address, ENT_NOQUOTES);
}

function save_image($file, $media_type, $benchID, $userID) {
function save_image($file, $media_type, $benchID, $userID, $GPSrequired = false) {
$filename = $file['name'];
$file = $file['tmp_name'];

if (get_image_location($file) == false) {
return "<h3>No GPS tags in: {$filename}</h3>";
if ($GPSrequired == true) {
if (get_image_location($file) == false) {
return "<h3>No GPS tags in: {$filename}</h3>";
}
}

if (duplicate_file($file)) {
Expand Down

0 comments on commit 75a52ff

Please sign in to comment.