[TYPO3-english] Image from non-default storage isn't displayed

Jan Bednarik info at bednarik.org
Mon Jul 27 22:54:12 CEST 2015


Hi,

so I'm generating URL to an image in my extension:

<f:uri.image src="{blog.attachment.uid}" treatIdAsReference="1" 
maxWidth="1920"/>

As long as I'm uploading from FE into the default storage "fileadmin/", 
all works fine.

But when I tried to upload image into a different file storage that I've 
created, nothing is returned. I mean that above f:uri.image just returns 
empty string.

I'm uploading file like this:

/** @var \TYPO3\CMS\Core\Resource\StorageRepository $storageRepository */
             $storageRepository = 
$objectManager->get('TYPO3\CMS\Core\Resource\StorageRepository');
             /** @var \TYPO3\CMS\Core\Resource\ResourceStorage $storage */
             $storage = $storageRepository->findByUid($storagePid);
$newFileObject = $storage->addFile(
                     $fileData['tmp_name'], 
$storage->getRootLevelFolder(), $fileData['name']
                 );


The file was uploaded just fine. When I manually altered storage ID in 
sys_file to 1 (fileadmin/), the URL to the image was again generated fine.

Any ideas?

Running 6.2.

Jan


More information about the TYPO3-english mailing list