function getTitleFromFile(&$filename, $displayExt = 0) { $filename = str_replace('//', '/', $filename); $filename = str_replace(DS, '/', $filename); $folderArray = explode('/', $filename); // Explode the filename (folder and file name) $countFolderArray = count($folderArray); // Count this array $lastArrayValue = $countFolderArray - 1; // The last array value is (Count array - 1) $title = new JObject(); $title->with_extension = $folderArray[$lastArrayValue]; $title->without_extension = PhocaGalleryFile::removeExtension($folderArray[$lastArrayValue]); if ($displayExt == 1) { return $title->with_extension; } else { if ($displayExt == 0) { return $title->without_extension; } else { return $title; } } }