Some minor fixes

This commit is contained in:
Deon George 2016-07-01 15:59:22 +10:00
parent ad10cb32ce
commit ec4c7ae3d1
3 changed files with 12 additions and 6 deletions

View File

@ -66,14 +66,14 @@ class Import extends Command
if ($this->option('tags')) if ($this->option('tags'))
{ {
$tags = explode(',',$this->option('tags')); $tags = explode(',',$this->option('tags'));
$t = Tag::whereIn('tag',$tags)->pluck('id'); $t = Tag::whereIn('tag',$tags)->pluck('id')->toArray();
} }
// People // People
if ($this->option('people')) if ($this->option('people'))
{ {
$tags = explode(',',$this->option('people')); $tags = explode(',',$this->option('people'));
$p = Person::whereIn('tag',$tags)->pluck('id'); $p = Person::whereIn('tag',$tags)->pluck('id')->toArray();
} }
$c = 0; $c = 0;
@ -106,7 +106,7 @@ class Import extends Command
$po->filename = $file; $po->filename = $file;
} }
$po->date_taken = strtotime($po->property('exif:DateTime')); $po->date_taken = strtotime($po->property('exif:DateTime') ? $po->property('exif:DateTime') : $po->property('exif:DateTimeOriginal'));
$po->subsectime = $po->property('exif:SubSecTimeOriginal'); $po->subsectime = $po->property('exif:SubSecTimeOriginal');
$po->signature = $po->property('signature'); $po->signature = $po->property('signature');
@ -168,8 +168,10 @@ class Import extends Command
$this->info(sprintf('Image [%s] stored in DB: %s',$file,$po->id)); $this->info(sprintf('Image [%s] stored in DB: %s',$file,$po->id));
// Record our people and tags // Record our people and tags
$po->People()->sync($p->toArray()); if ($p)
$po->Tags()->sync($t->toArray()); $po->People()->sync($p);
if ($t)
$po->Tags()->sync($t);
} }
$bar->finish(); $bar->finish();

View File

@ -50,7 +50,7 @@ class Move extends Command
} }
elseif ($this->option('id')) elseif ($this->option('id'))
{ {
$po = Photo::notRemove()->notDuplicate()->where('id',Photo::path($this->option('id'))); $po = Photo::notRemove()->notDuplicate()->where('id',$this->option('id'));
} }
else else
{ {

View File

@ -31,6 +31,7 @@
<div class="text-center">{{ $photos->links() }}</div> <div class="text-center">{{ $photos->links() }}</div>
<div class="panel-body"> <div class="panel-body">
@if ($photos->count())
<form action="{{ url('/deletes') }}" method="POST"> <form action="{{ url('/deletes') }}" method="POST">
<table class="table table-striped table-condensed table-hover"> <table class="table table-striped table-condensed table-hover">
@foreach ($data as $k=>$v) @foreach ($data as $k=>$v)
@ -66,6 +67,9 @@ endswitch ?>
<button class="btn btn-default">Confirm Delete</button> <button class="btn btn-default">Confirm Delete</button>
{{ csrf_field() }} {{ csrf_field() }}
</form> </form>
@else
NONE!
@endif
</div> </div>
</div> </div>
</div> </div>