[TYPO3-dev] How to use Image-Object for higher resolutions ?

Franz Koch typo.removeformessage at fx-graefix.de
Fri May 22 12:03:15 CEST 2009


Hi,
> I intended something like this:
> 
> function cImage($file,$conf) {
>     $info = $this->getImgResource($file,$conf['file.']);
>     $GLOBALS['TSFE']->lastImageInfo=$info;
>     if (is_array($info))    {
>         ...
> 
> +       $myImgFile = $conf['file.']['noRescale'] ? $info['origFile'] : 
> $info[3];
> +       $myWidth = intval($conf['file.']['resolution']) ? $info[0] / 
> intval($conf['file.']['resolution']) : $info[0];
> +       $myHeight = intval($conf['file.']['resolution']) ? $info[1] / 
> intval($conf['file.']['resolution']) : $info[1];
> +
> -       $theValue = '<img 
> src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEncodeFP($info[3])).'" 
> width="'.$info[0].'" 
> height="'.$info[1].'"'.$this->getBorderAttr('border="'.intval($conf['border']).'"').(($conf['params'] 
> || is_array($conf['params.']))?' 
> '.$this->stdwrap($conf['params'],$conf['params.']):'').($altParam).' />';
> +       $theValue = '<img 
> src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEncodeFP($myImgFile)).'" 
> width="'.$myWidth.'" 
> height="'.$myHeight.'"'.$this->getBorderAttr('border="'.intval($conf['border']).'"').(($conf['params'] 
> || is_array($conf['params.']))?' 
> '.$this->stdwrap($conf['params'],$conf['params.']):'').($altParam).' />';

I think you don't need the 'noRescale' option. Just provide the 
'resolution' property and the rest can be calculated based on 72dpi 
default output resolution. So by setting the resolution to 300dpi (for 
imgResource, not for cImage), a image with 300px width would then get 
rendered with 1250px width (300px / 72dpi * 300dpi), while the img-tag 
properties stay at 300px. I think it would also be good if the create 
image itself would have the resolution set to 300dpi.

-- 
kind regards,
Franz Koch

---------------------------------------------------
PayPal-Account: 'paypal _at_ elements-net _dot_ de'
---------------------------------------------------




More information about the TYPO3-dev mailing list