Typo3流体图像ViewHelper和上载目录
我试图在typo3页面中使用页面内容图像。我上传了2张图片,在DB中只存储文件名 好的-我在上传目录中找到了这些图片! 但现在我该如何显示图像 我可以对upload dir url进行HRD编码,并从db中添加文件名,但它确实很难看,而且不灵活 我试图使用Typo3流体图像ViewHelper和上载目录,typo3,fluid,typo3-flow,viewhelper,Typo3,Fluid,Typo3 Flow,Viewhelper,我试图在typo3页面中使用页面内容图像。我上传了2张图片,在DB中只存储文件名 好的-我在上传目录中找到了这些图片! 但现在我该如何显示图像 我可以对upload dir url进行HRD编码,并从db中添加文件名,但它确实很难看,而且不灵活 我试图使用,但没有机会,因为它需要一个资源路径?! 好的-我找到了资源目录,但我无法从cms的standart typo3页面上传图像 对我来说非常有用,因为我需要显示不同大小的图像并进行裁剪。这一切都是在ViewHelper中实现的,但我不能告诉Vie
,但没有机会,因为它需要一个资源路径?!
好的-我找到了资源目录,但我无法从cms的standart typo3页面上传图像
对我来说非常有用,因为我需要显示不同大小的图像并进行裁剪。这一切都是在ViewHelper中实现的,但我不能告诉ViewHelper在upload dir中拍摄我的图像
请帮助我如何使用页面上的图像。页面控制上传图像的菜单在后端非常有用,但我无法在前端显示结果。尝试使用类似的方法:
如果在
TCA columns config(uploadfolder)
中设置了上载目录,您可以写入并获取上载目录,例如:
/**
* @param Tx_(extkey)_Domain_Model_(entity class) $entity
* @return string rendered image tags
*/
public function render($entity) {
$html = '';
$GLOBALS['TSFE']->includeTCA();
$uploadfolder = $GLOBALS['TCA']['tx_(extkey)_domain_model_(entity class)']['columns']['(column_name)']['config']['uploadfolder'];
$images = explode(',', $entity->getImages());
foreach ($images as $image) {
$html .= $this->getImageTag($uploadfolder, $image, $width);
}
return $html;
}
查看Tx\u Fluid\u ViewHelpers\u ImageViewHelper
类(尤其是render
方法),获取格式化图像标记的代码