getSize() === 0) { return null; } $sourceTmp = Server::get(ITempManager::class)->getTemporaryFile(); $targetTmp = Server::get(ITempManager::class)->getTemporaryFile(); $this->tmpFiles[] = $sourceTmp; $this->tmpFiles[] = $targetTmp; try { $content = $file->fopen('r'); file_put_contents($sourceTmp, $content); $zip = new ZIP($sourceTmp); $zip->extractFile($path, $targetTmp); $image = new Image(); $image->loadFromFile($targetTmp); $image->fixOrientation(); return $image; } catch (\Throwable $e) { return null; } } }