getImageIterator($dirInfo); $it->rewind(); return $it->current(); } protected function getImageIterator(\SplFileInfo $dirInfo) { $it = new \AppendIterator(); $it->append( new \GlobIterator($dirInfo->getPathName() . '/*.jpg') ); $it->append( new \GlobIterator($dirInfo->getPathName() . '/*.JPG') ); return $it; } protected function getImageUrl($path) { return $this->getBaseUrl() . 'image?path=' . urlencode($this->getRelPath($path)); } protected function getRelPath($path) { return substr($path, strlen($GLOBALS['imagestore']['basedir'])); } } ?>