[TYPO3-mvc] imageViewHelper: "Could not get image resource for ..."

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Sun May 30 19:41:50 CEST 2010


Am 30.05.2010 19:22, schrieb Henjo Hoeksma:
> Franz Koch<typo3.RemoveForMessage at elements-net.de>  wrote:
>> Hi Henjo,
>>
>>> I run into a fluid issue though when trying to use images. I get the
>>> error: "Could not get image resource for " followed by the filename.
>>>
>>> My Fluid looks like this:
>>> <f:image src="{product.image}" width="50" alt="{product.name}" />
>>>
>>> My Model uses:
>>> /**
>>> * Image of the product
>>> * @var string
>>> */
>>> protected $image;
>>>
>>> What am I missing?
>>
>> Does {product.image} already contain the full relative path to the
>> document root of typo3 (so including your upload folder)? If not, try
>> this:
>> <f:image src="uploads/pics/{product.image}" width="50"
>> alt="{product.name}" />
>>
> Hi Franz, thanks for replying. No it doesn't. How could I set it to be
> like that so I can keep my fluid nice? :-)
>
> Thanks,
> Henjo

For my projects I set the path via TS and add it in the template like this:

<f:image src="{settings.images.path}{product.image}"/>

Therefor you need to assign the settings in the controller:

$this->view->assign('settings', $this->settings);

But you could also return the full path within your getImages() method 
in your model.

Regards,
Thomas


More information about the TYPO3-project-typo3v4mvc mailing list