LinkStack/app/Functions/findfile.php

23 lines
646 B
PHP
Raw Normal View History

<?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;
2023-02-13 17:18:32 +01:00
}
function findBackground($name){
$directory = base_path('/img/background-img/');
$files = scandir($directory);
$pathinfo = "error.error";
foreach($files as $file) {
if (strpos($file, $name.'.') !== false) {
$pathinfo = $name. "." . pathinfo($file, PATHINFO_EXTENSION);
}}
return $pathinfo;
}