[TYPO3-mvc] Any updates on group support (dam) in extbase?
Franz Koch
typo3.RemoveForMessage at elements-net.de
Wed Oct 13 18:47:42 CEST 2010
Hey,
> I'm wondering about group support (specifically for DAM) in extbase -- will
> a patch for the current extbase verison be available anytime soon? The
> issue is on forge here http://forge.typo3.org/issues/6249, but not yet
> resolved.
using my patch from the related ticket I'm using DAM in almost every
extbase extension I created so far - so it's working fine for me.
> Specifically I'd like to have an FE upload form, where the user can add an
> image, and then after uploading have that image be indexed by DAM and then
> assigned to a model property. Does anyone know of any ways to do this in
> extbase (either nicely or a workaround)?
That's mostly a DAM issue on how to index files from within FE.
Unfortunately AFAIK DAM is still missing a method to easily index files
from the FE - so you have to create your own indexer instance, configure
it correctly and do everything on your own. So something like that (take
from dam_frontend - but I did it simmilar years back when I needed it):
// the indexer gets the metadata from the document
$indexer = t3lib_div::makeInstance('tx_dam_indexing');
$indexer->init();
$indexer->setDefaultSetup();
$indexer->initEnabledRules();
$indexer->collectMeta = true;
$indexer->setDryRun(true); // just getting metadata from the dock
$indexer->setPID(tx_dam_db::getPid());
$indexer->setRunType("man");
$data = $indexer->indexfile($path,0);
$newrecord = $data['fields'];
// unsetting all array elements, which are not used
unset($newrecord['__type']);
unset($newrecord['__exists']);
unset($newrecord['file_title']);
unset($newrecord['file_path_absolute']);
unset($newrecord['file_path_relative']);
unset($newrecord['file_extension']);
unset($newrecord['file_owner']);
unset($newrecord['file_perms']);
unset($newrecord['file_writable']);
unset($newrecord['file_readable']);
// executing the insert operation for the database
$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_dam', $newrecord);
$recordID = $GLOBALS['TYPO3_DB']->sql_insert_id();
If you have a damRepository, you could thaw a new object, add it to the
repository and assign it to your related domainObject etc - might be the
cleaner approach then calling exec_INSERTquery and fetch the object
afterwards again.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list