function loadImage($dirs, $base, $md5Text, $alternativeText, $imageType) { $name = preg_replace(array("#[^a-zA-Z0-9_-]+#", "#__+#", "#_\$#"), array('_', '_', ''), $alternativeText); $file = "{$name}.{$imageType}"; $splitMD5Path = eZDir::getPathFromFilename($md5Text); $dirPath = eZDir::path(array($dirs, $base, $splitMD5Path, $md5Text)); $filePath = eZDir::path(array($dirPath, $file)); $fileHandler = eZClusterFileHandler::instance($filePath); if (!$fileHandler->exists()) { return null; } // we use a local cache of the file, because the eZImage library only works on files on the file system $fileHandler->fetch(true); return eZImageLayer::createForFile($file, $dirPath, $this->StoreAs); }