Added support for custom favicon
Custom logo and custom favicons can now have any supported format.
This commit is contained in:
parent
8fb722f32d
commit
38c856484d
|
@ -248,13 +248,37 @@ class AdminController extends Controller
|
|||
{
|
||||
$message = $request->message;
|
||||
$logo = $request->file('image');
|
||||
$icon = $request->file('icon');
|
||||
|
||||
Page::first()->update(['home_message' => $message]);
|
||||
|
||||
if (!empty($logo)) {
|
||||
$logo->move(base_path('/littlelink/images/'), "avatar.png");
|
||||
// Delete existing image
|
||||
$directory = base_path('/littlelink/images/');
|
||||
$files = scandir($directory);
|
||||
$pathinfo = "error.error";
|
||||
foreach($files as $file) {
|
||||
if (strpos($file, "avatar".'.') !== false) {
|
||||
$pathinfo = "avatar". "." . pathinfo($file, PATHINFO_EXTENSION);
|
||||
}}
|
||||
if(file_exists(base_path('/littlelink/images/').$pathinfo)){File::delete(base_path('/littlelink/images/').$pathinfo);}
|
||||
|
||||
$logo->move(base_path('/littlelink/images/'), "avatar.".$request->file('image')->extension());
|
||||
}
|
||||
|
||||
if (!empty($icon)) {
|
||||
// Delete existing image
|
||||
$directory = base_path('/littlelink/images/');
|
||||
$files = scandir($directory);
|
||||
$pathinfo = "error.error";
|
||||
foreach($files as $file) {
|
||||
if (strpos($file, "favicon".'.') !== false) {
|
||||
$pathinfo = "favicon". "." . pathinfo($file, PATHINFO_EXTENSION);
|
||||
}}
|
||||
if(file_exists(base_path('/littlelink/images/').$pathinfo)){File::delete(base_path('/littlelink/images/').$pathinfo);}
|
||||
|
||||
$icon->move(base_path('/littlelink/images/'), "favicon.".$request->file('icon')->extension());
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ return $path;}
|
|||
@include('layouts.fonts')
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/normalize.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/animate.css') }}">
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/avatar.png') }}">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('favicon')))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/'.findFile('favicon')) }}">
|
||||
@else
|
||||
<link rel="icon" type="image/svg+xml" href="{{ asset('littlelink/images/logo.svg') }}">
|
||||
@endif
|
||||
|
@ -184,8 +184,8 @@ foreach($pages as $page)
|
|||
</div>
|
||||
<div class="column" style="margin-top: 15%">
|
||||
<!-- Your Image Here -->
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<img alt="avatar" src="{{ asset('littlelink/images/avatar.png') }}" width="auto" height="128px">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('avatar')))
|
||||
<img alt="avatar" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" width="auto" height="128px">
|
||||
@else
|
||||
<div class="logo-container fadein">
|
||||
<img class="rotate" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo" style="width:150px; height:150px;">
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/avatar.png') }}">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('favicon')))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/'.findFile('favicon')) }}">
|
||||
@else
|
||||
<link rel="icon" type="image/svg+xml" href="{{ asset('littlelink/images/logo.svg') }}">
|
||||
@endif
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="stylesheet" href="{{ asset('littlelink/css/brands.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/hover-min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/animate.css') }}">
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/avatar.png') }}">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('favicon')))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/'.findFile('favicon')) }}">
|
||||
@else
|
||||
<link rel="icon" type="image/svg+xml" href="{{ asset('littlelink/images/logo.svg') }}">
|
||||
@endif
|
||||
|
|
|
@ -5,6 +5,18 @@
|
|||
<html lang="en">
|
||||
@endif
|
||||
|
||||
@php
|
||||
function findFile($name){
|
||||
$directory = base_path('/littlelink/images/');
|
||||
$files = scandir($directory);
|
||||
$pathinfo = "error.error";
|
||||
foreach($files as $file) {
|
||||
if (strpos($file, $name.'.') !== false) {
|
||||
$pathinfo = $name. "." . pathinfo($file, PATHINFO_EXTENSION);
|
||||
}}
|
||||
return $pathinfo;
|
||||
}
|
||||
@endphp
|
||||
|
||||
{{-- Redirects to https if enabled in the advanced-config --}}
|
||||
@if(env('FORCE_ROUTE_HTTPS') == 'true')
|
||||
|
|
|
@ -104,8 +104,8 @@ if($url1sb == '200' or $url2sb == '200') {
|
|||
}
|
||||
// end security check ?>
|
||||
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/avatar.png') }}">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('favicon')))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/'.findFile('favicon')) }}">
|
||||
@else
|
||||
<link rel="icon" type="image/svg+xml" href="{{ asset('littlelink/images/logo.svg') }}">
|
||||
@endif
|
||||
|
@ -181,8 +181,8 @@ if($url1sb == '200' or $url2sb == '200') {
|
|||
<a href="{{ url('/panel/index') }}">
|
||||
@endif
|
||||
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<img class="img logo" src="{{ asset('littlelink/images/avatar.png') }}" style="width:150px;height:auto;">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('avatar')))
|
||||
<img class="img logo" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" style="width:150px;height:auto;">
|
||||
@else
|
||||
<img class="img logo" type="image/svg+xml" src="{{ asset('littlelink/images/logo.svg') }}" style="width:100px;">
|
||||
@endif
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
<link rel="stylesheet" href="{{ asset('littlelink/css/animate.css') }}">
|
||||
<script src="{{ asset('studio/external-dependencies/fontawesome.js') }}" crossorigin="anonymous"></script>
|
||||
<link rel="stylesheet" href="{{ asset('studio/external-dependencies/fontawesome.css') }}" />
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/avatar.png') }}">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('favicon')))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/'.findFile('favicon')) }}">
|
||||
@else
|
||||
<link rel="icon" type="image/svg+xml" href="{{ asset('littlelink/images/logo.svg') }}">
|
||||
@endif
|
||||
|
|
|
@ -80,8 +80,8 @@ return $path;}
|
|||
@include('layouts.fonts')
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/normalize.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/animate.css') }}">
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/avatar.png') }}">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('favicon')))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/'.findFile('favicon')) }}">
|
||||
@else
|
||||
<link rel="icon" type="image/svg+xml" href="{{ asset('littlelink/images/logo.svg') }}">
|
||||
@endif
|
||||
|
@ -247,8 +247,8 @@ function get_operating_system() {
|
|||
<!-- Your Image Here -->
|
||||
@if(file_exists(base_path("img/$littlelink_name" . ".png" )))
|
||||
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset("img/$littlelink_name" . ".png") }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@elseif(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset('littlelink/images/avatar.png') }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@elseif(file_exists(base_path("littlelink/images/").findFile('avatar')))
|
||||
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@else
|
||||
<img alt="avatar" class="rounded-avatar fadein" src="{{ asset('littlelink/images/logo.svg') }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@endif
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
@include('layouts.fonts')
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/normalize.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/animate.css') }}">
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/avatar.png') }}">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('favicon')))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/'.findFile('favicon')) }}">
|
||||
@else
|
||||
<link rel="icon" type="image/svg+xml" href="{{ asset('littlelink/images/logo.svg') }}">
|
||||
@endif
|
||||
|
@ -80,8 +80,8 @@ body {
|
|||
<div class="containerr" style="">
|
||||
<div class="column">
|
||||
<!-- Your Image Here -->
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<img alt="avatar" src="{{ asset('littlelink/images/avatar.png') }}" width="auto" height="200px">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('avatar')))
|
||||
<img alt="avatar" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" width="auto" height="200px">
|
||||
@else
|
||||
<div class="logo-container">
|
||||
<img src="{{ asset('littlelink/images/logo.svg') }}" alt="Logo" style="width:200px; height:200px;">
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<link rel="stylesheet" href="{{ asset('littlelink/css/brands.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/hover-min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('littlelink/css/animate.css') }}">
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/avatar.png') }}">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('favicon')))
|
||||
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/'.findFile('favicon')) }}">
|
||||
@else
|
||||
<link rel="icon" type="image/svg+xml" href="{{ asset('littlelink/images/logo.svg') }}">
|
||||
@endif
|
||||
|
@ -70,8 +70,8 @@
|
|||
|
||||
<div class="column" style="margin-top: 10%">
|
||||
<!-- Your Image Here -->
|
||||
@if(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<img src="{{ asset('littlelink/images/avatar.png') }}" width="auto" height="100px">
|
||||
@if(file_exists(base_path("littlelink/images/").findFile('avatar')))
|
||||
<img src="{{ asset('littlelink/images/'.findFile('avatar')) }}" width="auto" height="100px">
|
||||
@else
|
||||
<div class="logo-container fadein">
|
||||
<img class="rotate" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo" style="width:150px; height:150px;">
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<div class="form-group col-lg-8">
|
||||
@if(file_exists(base_path("img/$user->littlelink_name" . ".png" )))
|
||||
<img src="{{ asset("img/$user->littlelink_name" . ".png") }}" srcset="{{ asset("img/$user->littlelink_name" . "@2x.png 2x") }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@elseif(file_exists(base_path("littlelink/images/avatar.png" )))
|
||||
<img class="rounded-avatar" src="{{ asset('littlelink/images/avatar.png') }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@elseif(file_exists(base_path("littlelink/images/").findFile('avatar')))
|
||||
<img class="rounded-avatar" src="{{ asset('littlelink/images/'.findFile('avatar')) }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@else
|
||||
<img src="{{ asset('littlelink/images/logo.svg') }}" srcset="{{ asset('littlelink/images/avatar@2x.png 2x') }}" width="128px" height="128px" style="object-fit: cover;">
|
||||
@endif
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
<label>Site logo</label>
|
||||
<input type="file" class="form-control-file" name="image">
|
||||
</div>
|
||||
<div class="form-group col-lg-8">
|
||||
<label>Favicon</label>
|
||||
<input type="file" class="form-control-file" name="icon">
|
||||
</div>
|
||||
<div class="form-group col-lg-8">
|
||||
<h3>Home message</h3>
|
||||
<textarea class="form-control ckeditor" name="message" rows="3">{{ $home_message }}</textarea>
|
||||
|
|
Loading…
Reference in New Issue