Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Commit

Permalink
fix error when no images are stored (bug in previous scommit)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Verstraeten committed Jan 7, 2017
1 parent 3d0b028 commit 3386ad6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
11 changes: 11 additions & 0 deletions app/controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
]);
}
Expand Down
4 changes: 3 additions & 1 deletion app/views/controls/hullselection.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
if($imageFile)
{
$image = Image::make($imageFile['path']);
$src = $imageFile['src'];
}
else
{
// fake an image
$image = Image::canvas(800, 640);
$src = '';
}
?>

Expand All @@ -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}}");
Expand Down
4 changes: 3 additions & 1 deletion app/views/controls/twolines.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
if($imageFile)
{
$image = Image::make($imageFile['path']);
$src = $imageFile['src'];
}
else
{
// fake an image
$image = Image::canvas(800, 640);
$src = '';
}
?>

Expand All @@ -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}}");
Expand Down
2 changes: 1 addition & 1 deletion app/views/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<canvas id="latest-activity-sequence"></canvas>
</li>
<li class="heat">
<img src="<?=App::make("Controllers\ImageController")->getLatestImage()['src']?>" id="latest-image" style="display: none;"/>
<img src="<?= $lastImage ?>" id="latest-image" style="display: none;"/>
<div class="heatmap" style="width: 100%;"></div>
</li>
</ul>
Expand Down

0 comments on commit 3386ad6

Please sign in to comment.