Contao模板中如何获取实际图片路径
How to get actual image path in Contao template
为文件上传添加一个额外的字段。但是模板中获取的数据是一组特殊字符。如何获取原始路径?
我的代码:
$GLOBALS['TL_DCA']['tl_news']['fields']['image'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_news']['quoteperson_image'],
'exclude' => true,
'filter' => true,
'inputType' => 'fileTree',
'eval' => array('tl_class' => 'clr','files' => true,'fieldType' =>'checkbox',),
'sql' => "blob NULL",
);
fileTree
小部件返回的数据是二进制 UUID。为了获得原始路径,您可以执行以下操作,例如:
$objFile = \Contao\FilesModel::findByUuid($uuid);
$strPath = $objFile->path;
为文件上传添加一个额外的字段。但是模板中获取的数据是一组特殊字符。如何获取原始路径?
我的代码:
$GLOBALS['TL_DCA']['tl_news']['fields']['image'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_news']['quoteperson_image'],
'exclude' => true,
'filter' => true,
'inputType' => 'fileTree',
'eval' => array('tl_class' => 'clr','files' => true,'fieldType' =>'checkbox',),
'sql' => "blob NULL",
);
fileTree
小部件返回的数据是二进制 UUID。为了获得原始路径,您可以执行以下操作,例如:
$objFile = \Contao\FilesModel::findByUuid($uuid);
$strPath = $objFile->path;