public function getTemplateSize($tpl, $width = null, $height = null)
    {
        if (!isset($this->templates[$tpl])) {
            return false;
        }

        if ($width === null && $height === null) {
            $width = $this->templates[$tpl]['width'];
            $height = $this->templates[$tpl]['height'];
        } elseif ($width === null) {
            $width = $height * $this->templates[$tpl]['width'] / $this->templates[$tpl]['height'];
        }

        if ($height === null) {
            $height = $width * $this->templates[$tpl]['height'] / $this->templates[$tpl]['width'];
        }

        if ($height <= 0. || $width <= 0.) {
            throw new \InvalidArgumentException('Width or height parameter needs to be larger than zero.');
        }

        return [
            'width' => $width,
            'height' => $height,
            0 => $width,
            1 => $height,
            'orientation' => $width > $height ? 'L' : 'P'
        ];
    }
public function getTemplateSize($tpl, $width = null, $height = null)
    {
        if (!isset($this->templates[$tpl])) {
            return false;
        }

        if ($width === null && $height === null) {
            $width = $this->templates[$tpl]['width'];
            $height = $this->templates[$tpl]['height'];
        } elseif ($width === null) {
            $width = $height * $this->templates[$tpl]['width'] / $this->templates[$tpl]['height'];
        }

        if ($height === null) {
            $height = $width * $this->templates[$tpl]['height'] / $this->templates[$tpl]['width'];
        }

        if ($height <= 0. || $width <= 0.) {
            throw new \InvalidArgumentException('Width or height parameter needs to be larger than zero.');
        }

        return [
            'width' => $width,
            'height' => $height,
            0 => $width,
            1 => $height,
            'orientation' => $width > $height ? 'L' : 'P'
        ];
    }
public function getTemplateSize ( $ tpl , $ width = null , $ height = null ) { if ( ! isset ( $ this -> templates [ $ tpl ] ) ) { return false ; } if ( $ width === null && $ height === null ) { $ width = $ this -> templates [ $ tpl ] [ 'width' ] ; $ height = $ this -> templates [ $ tpl ] [ 'height' ] ; } elseif ( $ width === null ) { $ width = $ height * $ this -> templates [ $ tpl ] [ 'width' ] / $ this -> templates [ $ tpl ] [ 'height' ] ; } if ( $ height === null ) { $ height = $ width * $ this -> templates [ $ tpl ] [ 'height' ] / $ this -> templates [ $ tpl ] [ 'width' ] ; } if ( $ height <= 0. || $ width <= 0. ) { throw new \ InvalidArgumentException ( 'Width or height parameter needs to be larger than zero.' ) ; } return [ 'width' => $ width , 'height' => $ height , 0 => $ width , 1 => $ height , 'orientation' => $ width > $ height ? 'L' : 'P' ] ; }
Get the size of a template.

Give only one of the size parameters (width, height) to calculate the other one automatically in view to the
aspect ratio.

@param mixed $tpl The template id
@param float|int|null $width The width.
@param float|int|null $height The height.
@return array|bool An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P)
Get the size of a template .