fabarea / media

Media management system for TYPO3 CMS
Other
30 stars 25 forks source link

Uncaught TYPO3 Exception #1300096564: uid of file has to be numeric. #15

Open loco8878 opened 9 years ago

loco8878 commented 9 years ago

Reproduction

  1. In the Media selection Add Video e.g. (Content -> FCE -> Video)
  2. click on preview icon => error
  3. click edit image (label/title is wrong) => success

Uncaught TYPO3 Exception

1300096564: uid of file has to be numeric. (More information)

InvalidArgumentException thrown in file typo3/sysext/core/Classes/Resource/ResourceFactory.php in line 340.

8 TYPO3\CMS\Core\Resource\ResourceFactory::getFileObject("undefined") addvideo

cweiske commented 9 years ago

Steps to reproduce the issue on a stock TYPO3 system:

  1. Create new "File links" content element (Category "special elements")
  2. At "Select single files" click "Add file". The selector opens.
  3. Choose an mp4 file by clicking on the MPEG4 icon left of the title
  4. The selector closes. The TYPO3 page will show a popup that a 500 error occured on the server:

    Error: 500 Internal Server error

Strangely it works with a .png file.

This happens with media 3.5.1/vidi 0.9.0.

philippjbauer commented 9 years ago

The data-uid attribute is missing on video items in the pop-up browser. To add it, the method renderTagAnchor in the file EXT:media/Classes/Thumbnail/VideoThumbnailProcessor.php has to be changed. See:

/**
     * Render a wrapping anchor around the thumbnail.
     *
     * @param string $result
     * @return string
     */
    public function renderTagAnchor($result) {

        $file = $this->getFile();

        return sprintf('<a href="%s%s" target="%s" data-uid="%s">%s</a>',
            $this->thumbnailService->getAnchorUri() ? $this->thumbnailService->getAnchorUri() : $file->getPublicUrl(TRUE),
            $this->thumbnailService->getAppendTimeStamp() ? '?' . $file->getProperty('tstamp') : '',
            $this->thumbnailService->getTarget(),
            $file->getUid(),
            $result
        );
    }

I turned off thumbnail generation in the TCA because I don't know about the capability of TYPO3 to generate thumbs from various video files and didn't do testing on it. Here how it was done:

$GLOBALS['TCA']['tx_myextension_domain_model_mymodel']['columns']['video']['config'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
    'video',
    array(
        'maxitems' => 1,
        'appearance' => array(
            'useSortable' => TRUE,
            'headerThumbnail' => FALSE, // <--- this is the important part here, everything else is copied from the getFileFieldTCAConfig method
            'showPossibleLocalizationRecords' => FALSE,
            'showRemovedLocalizationRecords' => FALSE,
            'showSynchronizationLink' => FALSE,
            'showAllLocalizationLink' => FALSE,
            'enabledControls' => array(
                'info' => TRUE,
                'new' => FALSE,
                'dragdrop' => TRUE,
                'sort' => FALSE,
                'hide' => TRUE,
                'delete' => TRUE,
                'localize' => TRUE,
            ),
        ),
    ),
    '*'
);