/** * @param array $parameters */ public function renderField(array $parameters) { $uid = $parameters['row']['file'][0]; $fileObject = Utility::uid2file($parameters['row']['file'][0]); $name = $fileObject->getIdentifier(); return '<div data-uid="' . $uid . '" data-name="' . $name . '" class="semanticimage" />'; }
private function analysisCall($method, $uid) { $temp = Utility::copyToPublic($uid); $result = $this->analysisClient()->get('methodGET', ['query' => ['imagePaths' => $temp['url'], 'method' => $method]]); Utility::decopyFromPublic($temp); $xmlstring = (string) $result->getBody(); $xml = simplexml_load_string($xmlstring); return $xml; }
public static function isImage($file) { return in_array($file->getExtension(), Utility::getKnownImageExtensions()); }
private function addToZip($fileOrFolder, $zip) { if ($fileOrFolder instanceof FolderInterface) { foreach ($fileOrFolder->getFiles() as $file) { $this->addToZip($file, $zip); } foreach ($fileOrFolder->getSubfolders() as $folder) { $this->addToZip($folder, $zip); } } else { if ($fileOrFolder instanceof FileInterface && Utility::isImage($fileOrFolder)) { $path = $fileOrFolder->getUid() . '.' . $fileOrFolder->getExtension(); $zip->addFromString($path, $fileOrFolder->getContents()); } } }