[TYPO3-dev] FEuser resize image dynamically

Mathias Schreiber [wmdb] mathias.schreiber at wmdb.de
Wed Dec 1 09:16:28 CET 2010


Am 01.12.10 05:00, schrieb Siddhesh:
> As this was my first development.Your idea helped for me.I had one more
> question for u.IF i want some thing like this

You're welcome, glad I could help out.

> For every record admin must have the provision to decide for its height
> and width of the image??then how can i ove ahead

In this case I'd add two fields to the record (or maybe one field for a 
syntax like 150x230, but experience has shown that editors don't get the 
idea).

I try to get you a bit deeper into the PHP/TS connection.
TS is nothing more than a syntax to describe PHP arrays.
This means:
plugin.tx_yourExtension.imgConf.file.width = 250
will translate into:
$this->conf['imgConf.']['file.']['width']
in your extensions PHP code (note that the function main() from the 
kickstarter does $this->conf = $conf very early so that you have the TS 
available in all your functions).

Also notice the dots at the end of each "key", this mostly causes 
trouble to new developers.

So if you want to have it bulletproof I'd set defaults via TS and give 
the editor the chance to override these on a per-record basis.

You don't want to force your editors in entring a value in the 
height/width fields.

Then, back in PHP, where you get the actual row from the DB you could 
simply check if someone entered a value into the according fields and 
use these values to overwrite the defaults from TS.

Beware:
If both height and width are supplied, TYPO3 will hard-scale the image, 
so I suggest to use maxH and maxW to define the maximum allowed size of 
the image.

I hope you have more fun with TYPO3 extension coding now.

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