theowi
theowi

Reputation: 820

Square thumbnails

I want to generate a square thumbnail from a sourceimage for a TYPO3 gallery extension, but I don't find a way to do this. It can be a square section from the source image.

To decrease the image proportional to an thumbnail, i use the following function:

    function generateImg($w,$h,$fname,$dir,$class,$id){
    $imgTSConfig = array();
    $imgTSConfig['file'] = $dir.'/'.$fname;                         
    $imgTSConfig['file.']['maxW'] = $w;
    $imgTSConfig['file.']['maxH'] = $h;
    $imgTSConfig['stdWrap.']['addParams.']['class'] = $cl;
    $imgTSConfig['stdWrap.']['addParams.']['id'] = $id;

    $timg = $this->cObj->image($imgTSConfig); 
    return($timg);
}

Upvotes: 1

Views: 293

Answers (1)

Mateng
Mateng

Reputation: 3734

Try this:

$imgTSConfig['file.']['width'] = '120';
$imgTSConfig['file.']['height'] = '120c';

...instead of (or combined with) maxH and maxW. The 'c' parameter crops the image if it is to high.

Source

Upvotes: 2

Related Questions