[TYPO3-dev] FEuser resize image dynamically

Mathias Schreiber [wmdb] mathias.schreiber at wmdb.de
Tue Nov 30 13:02:58 CET 2010


Am 30.11.10 12:11, schrieb Siddhesh:
> Hello list,
> I am developing a small extension.Let me Explain what does it does.
> I have a list of users which are displayed in list View.
> When the user clicks on one of the row in list view its Detail View
> appers.In Detail view i have 4 fields
> 1)Image of user
> 2)Name
> 3)Official function
> 3)country
>
> Now let me explain me my problem
> I have created the image object and had displayed the image with fixed
> height and width
>
> $cObjType = $this->conf['detailpicture'];
> $conf = $this->conf['detailpicture.'];
> $cObj = t3lib_div::makeInstance('tslib_cObj');
> $cObj->start($row, '_NO_TABLE');

First off:
As long as you are within an extension context, cObj is already there.
So something like this will work:
$img = $this->cObj->IMAGE($imgConf);

TS would look like this:
imgConf = IMAGE
imgConf.file =
imgConf.file.width = 125

In PHP you simply override the path to the file with:
$this->conf['imgConf.']['file'] = 'uploads/pics/' . $row['image'];

If you need two image sizes, simply do something like this:

TS:
imgConfBig < imgConf
imgConfBig.file.width = 250

Render accordingly.

cheers
Mathias

-- 
Ernesto, Nov. 9th 2010:
"In the graphics generation routines of TYPO3 *anything* could cause a
side effect."




More information about the TYPO3-dev mailing list