Wednesday, June 24, 2015

Wie erhalte ich eine FAL Datei Referenz z.b. zur Verwendung mit TypoScript IMAGE cObject?









        $relationHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
        $configuration = $GLOBALS['TCA']['tt_content']['columns']['image']['config'];
        $relationHandler->start($imagedata['image'], $configuration['foreign_table'], $configuration['MM'], $imagedata['uid'], 'tt_content', $configuration);
        $relationHandler->processDeletePlaceholder();
        $referenceUids = $relationHandler->tableArray[$configuration['foreign_table']];
        foreach ($referenceUids as $referenceUid) {
            try {
                $fileReference = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($referenceUid, array(), ($wsid === 0));
                //$origFile = $fileReference->getOriginalFile();
                $filename = $fileReference->getName();
                // write back to our $imagedata element... (for compatibility)
                $imagedata['image'] = $filename;
                // ...and store fileReference identifier for later use:
                $imagedata['fileref_uid'] = $fileReference->getUid();
            } catch (\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException $e) {
                /* just catch exception, because we can't do anything about it here */
            }
        }


       $confIMG = array(
            'file' => isset($imagedata['fileref_uid']) ? $imagedata['fileref_uid'] : 'uploads/pics/'.$imagedata['image'],
            'file.' => array (
                'width' => $width,
                'treatIdAsReference' => isset($imagedata['fileref_uid']) ? 1 : 0,
            ),
            'params' => 'align="left" style="margin:0 10px 5px 0;"',
            'titleText' => trim($imagedata['tx_team_position'].' '.$imagedata['header']),
        );

Saturday, June 13, 2015

Zeichensatz-Konvertierung / TYPO3-Datenbank Zeichensatz / ...



echo "ALTER DATABASE mydb CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql
mysqldump --default-character-set=latin1 --databases mydb > a.sql
cp a.sql b.sql
sed -i 's/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8/g' b.sql
sed -i 's/CHARACTER SET latin1/CHARACTER SET utf8/g' b.sql
grep -v character_set_client <b.sql > c.sql
sed -i 's/SET NAMES latin1/SET NAMES utf8/g' c.sql
mysql --default-character-set=utf8 < c.sql


http://wiki.typo3.org/UTF-8_support#Convert_an_already_existing_database_to_UTF-8

http://www.i18nqa.com/debug/utf8-debug.html

http://www.utf8-chartable.de/unicode-utf8-table.pl

http://stackoverflow.com/questions/14980200/converting-special-charactes-such-as-%C3%83%C2%BC-and-%C3%83%C6%92-back-to-their-original-latin-alp

https://docs.typo3.org/typo3cms/InstallationGuide/UpgradeLTS/Index.html

http://php.net/manual/en/function.utf8-encode.php

http://php.net/manual/de/function.mb-convert-encoding.php