I am creating an app that displays only pictures where a certain profilename as been appended on to the beginning of the text.
for example 3 files in the folder are : Rogue-fastcar.jpg , John-girls.png, Petra-moneyNmore.jpg
I would like to return only the picture that has the profile that is stored within the session. So far its showing pictures from all users.
Thanks for the assistance, much appreciated.
foreach ($images as $index => $image) {
$extension = strtolower(end(explode('.', $image)));
$subject = $image;
$profile = "$_SESSION["profile"]";
$pattern = '/.$profile./';
preg_match($pattern, $subject, $matches);
if ($matches) {
echo "Worse Behavior";
if(!in_array($extension, $extensions)){
unset($images[$index]);
}else{
$images[$index] = array(
'full' => $this->path. '/' . $image,
'thum' => $this->path. '/thumb/' . $image
);
}
}
}