Skip to content

Commit

Permalink
Merge branch 'img2' of git://github.com/afa28/OpenDK into afa28-img2
Browse files Browse the repository at this point in the history
  • Loading branch information
eddieridwan committed Dec 8, 2020
2 parents c0e17e5 + f2fad58 commit 9548677
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 4 additions & 3 deletions app/Http/Controllers/Data/ProfilController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ public function index()
$page_description= 'Data Profil Kecamatan';
return view('data.profil.index', compact('page_title', 'page_description'));*/
$profil = Profil::where('kecamatan_id', config('app.default_profile'))->first();
if ($profil->file_struktur_organisasi == '') {
$profil->file_struktur_organisasi = 'http://placehold.it/600x400';
}

$profil->file_struktur_organisasi = is_img($profil->file_struktur_organisasi);
$profil->file_logo = is_img($profil->file_logo);

$page_title = 'Ubah Profil';
$page_description = 'Kecamatan: ' . ucwords(strtolower($profil->kecamatan->nama));

Expand Down
10 changes: 10 additions & 0 deletions helpers/general_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,13 @@ function is_wajib_ktp($umur, $status_kawin)
$wajib_ktp = (($umur > 16) or (!empty($status_kawin) and $status_kawin != 1));
return $wajib_ktp;
}

function is_img($img)
{
if ($img == '' || ! is_file($img)) {
$img = '/img/no-image.png';
}

return $img;
}

4 changes: 2 additions & 2 deletions resources/views/data/profil/form_edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class="required">*</span></label>
<input type="file" id="file_struktur" name="file_struktur_organisasi" accept="image/*"
class="validate form-control"/>
<br>
<img src="@if(! $profil->file_struktur_organisasi == ''){{ asset($profil->file_struktur_organisasi) }} @else {{ asset('/img/no-image.png') }} @endif" id="showgambar"
<img src="{{ asset($profil->file_struktur_organisasi) }}" id="showgambar"
style="max-width:200px;max-height:200px;float:left;"/>
</div>
</div>
Expand Down Expand Up @@ -133,7 +133,7 @@ class="required">*</span></label>
<input type="file" id="file_logo" name="file_logo" accept="image/*"
class="validate form-control"/>
<br>
<img src="@if(! $profil->file_logo == ''){{ asset($profil->file_logo) }} @else {{ asset('/img/no-image.png') }} @endif" id="showgambar2"
<img src="{{ asset($profil->file_logo) }}" id="showgambar2"
style="max-width:200px;max-height:200px;float:left;"/>
</div>
</div>
Expand Down

0 comments on commit 9548677

Please sign in to comment.