/** * Writes the GD font file * * @param \SJBR\SrFreecap\Domain\Model\Font the object to be stored * @return \SJBR\SrFreecap\Domain\Repository\FontRepository $this */ public function writeFontFile(\SJBR\SrFreecap\Domain\Model\Font $font) { $relativeFileName = 'uploads/' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($this->extensionKey) . '/' . $font->getGdFontFilePrefix() . '_' . \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5($font->getGdFontData()) . '.gdf'; if (\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_site . $relativeFileName, $font->getGdFontData())) { $font->setGdFontFileName($relativeFileName); } return $this; }
/** * Create the font file and display the result * * @param \SJBR\SrFreecap\Domain\Model\Font $font * @return string HTML presenting the new font that was created */ public function createAction(\SJBR\SrFreecap\Domain\Model\Font $font) { // Create the font data $font->createGdFontFile(); // Store the GD font file $fontRepository = $this->objectManager->get('SJBR\\SrFreecap\\Domain\\Repository\\FontRepository'); $fontRepository->writeFontFile($font); $this->view->assign('font', $font); }