/** * Returns a media object by a given file path or file info array for a file placed in uploads/. * Files in uploads/ are copies from files from fileadmin/ or direct uploads. * The meta data that might be found is not directly meant for the uploads-file but normally it matches the file and you get what you expect. * But for example the file might be placed in fileadmin/ twice with different meta data. Then you can't say which meta data you will get for the uploads-file. * * IMPORTANT * The media object does NOT handle the uploads file itself but a matching file which is placed in fileadmin/. Any operation will not affect the uploads-file but the fileadmin-file. * * @param mixed $fileInfo Is a file path or an array containing a file info from tx_dam::file_compileInfo(). * @param string $uploadsPath Uploads path. will be prepended if $fileInfo is a path (string). * @param string $mode TYPO3_MODE to be used: 'FE', 'BE'. Constant TYPO3_MODE is default. * @return object media object or false * @see tx_dam_media */ function media_getForUploadsFile($file, $uploadPath = '', $mode = TYPO3_MODE) { global $TYPO3_CONF_VARS; require_once PATH_txdam . 'lib/class.tx_dam_media.php'; $media = t3lib_div::makeInstance('tx_dam_media'); $media->setMode($mode); if ($row = tx_dam::meta_findDataForUploadsFile($file, $uploadPath, 'tx_dam.uid')) { $media->fetchIndexFromMetaUID($row['uid']); } return $media; }