From 3386ad6e149c8c7e917e5e6486be4b1a964972cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Sat, 7 Jan 2017 21:42:47 +0100 Subject: [PATCH] fix error when no images are stored (bug in previous scommit) --- app/controllers/DashboardController.php | 11 +++++++++++ app/views/controls/hullselection.blade.php | 4 +++- app/views/controls/twolines.blade.php | 4 +++- app/views/dashboard.blade.php | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/controllers/DashboardController.php b/app/controllers/DashboardController.php index 0cdda88..22c3c37 100755 --- a/app/controllers/DashboardController.php +++ b/app/controllers/DashboardController.php @@ -24,8 +24,19 @@ public function index() $days = $this->imageHandler->getDays(5); + $lastImage = $this->imageHandler->getLatestImage(); + if($lastImage) + { + $lastImage = $lastImage['src']; + } + else + { + $lastImage = ''; + } + return View::make('dashboard', [ 'days' => $days, + 'lastImage' => $lastImage, 'isUpdateAvailable' => $this->isUpdateAvailable() ]); } diff --git a/app/views/controls/hullselection.blade.php b/app/views/controls/hullselection.blade.php index cfadddc..7a5aaa3 100755 --- a/app/views/controls/hullselection.blade.php +++ b/app/views/controls/hullselection.blade.php @@ -8,11 +8,13 @@ if($imageFile) { $image = Image::make($imageFile['path']); + $src = $imageFile['src']; } else { // fake an image $image = Image::canvas(800, 640); + $src = ''; } ?> @@ -24,7 +26,7 @@ require(["app/controllers/hullselection"], function(hull) { hull.setElement($("#map")); - hull.setImage("{{$imageFile['src']}}"); + hull.setImage("{{$src}}"); hull.setImageSize("{{$image->width()}}","{{$image->height()}}"); hull.setCoordinates("{{$value}}"); hull.setName("{{$file."__".$attribute}}"); diff --git a/app/views/controls/twolines.blade.php b/app/views/controls/twolines.blade.php index 8734a0a..ee8936b 100644 --- a/app/views/controls/twolines.blade.php +++ b/app/views/controls/twolines.blade.php @@ -8,11 +8,13 @@ if($imageFile) { $image = Image::make($imageFile['path']); + $src = $imageFile['src']; } else { // fake an image $image = Image::canvas(800, 640); + $src = ''; } ?> @@ -24,7 +26,7 @@ require(["app/controllers/twolines"], function(twolines) { twolines.setElement($(".twolines #map")); - twolines.setImage("{{$imageFile['src']}}"); + twolines.setImage("{{$src}}"); twolines.setImageSize("{{$image->width()}}","{{$image->height()}}"); twolines.setCoordinates("{{$value}}"); twolines.setName("{{$file."__".$attribute}}"); diff --git a/app/views/dashboard.blade.php b/app/views/dashboard.blade.php index 1265ced..faf0e8e 100755 --- a/app/views/dashboard.blade.php +++ b/app/views/dashboard.blade.php @@ -36,7 +36,7 @@
  • - getLatestImage()['src']?>" id="latest-image" style="display: none;"/> +