diff --git a/app/Controllers/Api/Images/Upload.php b/app/Controllers/Api/Images/Upload.php index 3c4af46..b57ea88 100644 --- a/app/Controllers/Api/Images/Upload.php +++ b/app/Controllers/Api/Images/Upload.php @@ -20,6 +20,7 @@ class Upload DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :place, :content)', array(':postbody' => $postbody, ':userid' => Auth::userid(), ':time' => mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year']), ':content' => $content, ':photourl' => self::$photourl, ':exif' => $exif, ':place' => $_POST['place'], ':timeup'=>time())); echo json_encode( array( + 'id' => DB::query('SELECT id FROM photos ORDER BY id DESC LIMIT 1')[0]['id'], 'errorcode' => 0, 'error' => 0 ) @@ -30,7 +31,15 @@ class Upload if ($_FILES['image']['error'] != 4) { $exif = new EXIF($_FILES['image']['tmp_name']); + $exif = $exif->getData(); $upload = new UploadPhoto($_FILES['image'], 'cdn/img'); + if ($exif === null) { + $exif = Json::return( + array( + 'type' => 'none', + ) + ); + } if ($upload->getType() !== null) { $content = Json::return( array( @@ -40,7 +49,7 @@ class Upload ) ); self::$photourl = $upload->getSrc(); - self::create($_POST['descr'], $content, $exif->getData()); + self::create($_POST['descr'], $content, $exif); } } else { echo json_encode( diff --git a/views/pages/Profile/UploadPhoto.php b/views/pages/Profile/UploadPhoto.php index 02ded78..1f28b0c 100644 --- a/views/pages/Profile/UploadPhoto.php +++ b/views/pages/Profile/UploadPhoto.php @@ -724,7 +724,7 @@ return xhr; ws.send(JSON.stringify(positionData));*/ setTimeout(function() { - window.location.replace("/feed"); + window.location.replace("/photo/"+jsonData.id); scrollProgressBarWidth(0); }, 1000); } else if (jsonData.errorcode == "LIMITEXCEEDED") {