contao/test — Issue #1585: GetImage Aufruf in ContentHyperlink.php
Author: importer
Created: 2011-11-29 08:11:42+00:00
State: open
Labels: Defect, frontend

Hallo,

ich habe gestern die neue Version 2.8 installiert und die vielen neue Features ausprobiert. Dabei ist mir aufgefallen, das bei einem Image-Link die neue Angabe zur Verkleinerungsmethode nicht ausgewertet wird sondern immer beschnitten wird.
Wie sich herausstellte fehlt zumindest in der ContentHyperlink.php fehlt dafür die size[2]-Angabe in Zeile 87:

Original:

```
// Use an image instead of the title
if ($this->useImage && strlen($this->singleSRC) && is_file(TL_ROOT . '/' . $this->singleSRC))
{
$this->strTemplate = 'ce_hyperlink_image';
$this->Template = new FrontendTemplate($this->strTemplate);

$objFile = new File($this->singleSRC);

if ($objFile->isGdImage)
{
$size = deserialize($this->size);
$intMaxWidth = (TL_MODE == 'BE') ? 320 : $GLOBALS['TL_CONFIG']['maxImageWidth'];

// Adjust image size
if ($intMaxWidth > 0 && ($size[0] > $intMaxWidth || (

![]($size[0] && $objFile->width > $intMaxWidth)))
{
.	$size[0] = $intMaxWidth;
.	$size[1] = floor($intMaxWidth * $objFile->height / $objFile->width);
85	}
86
87	$src = $this->getImage($this->urlEncode($this->singleSRC), $size[0], $size[1]);
88
89	if (($imgSize = `getimagesize(TL_ROOT . '/' . $src)) )== false)
.	{
.	$this->Template->imgSize = ' ' . $imgSize[3];
}

$this->Template->src = $src;
$this->Template->alt = specialchars($this->alt);
$this->Template->title = specialchars($this->linkTitle);
$this->Template->caption = $this->caption;
}
}

```

Korrigierte Version:

```
// Use an image instead of the title
if ($this->useImage && strlen($this->singleSRC) && is_file(TL_ROOT . '/' . $this->singleSRC))
{
$this->strTemplate = 'ce_hyperlink_image';
$this->Template = new FrontendTemplate($this->strTemplate);

$objFile = new File($this->singleSRC);

if ($objFile->isGdImage)
{
$size = deserialize($this->size);
$intMaxWidth = (TL_MODE == 'BE') ? 320 : $GLOBALS['TL_CONFIG']['maxImageWidth'];

// Adjust image size
if ($intMaxWidth > 0 && ($size[0] > $intMaxWidth || (

![]($size[0] && $objFile->width > $intMaxWidth)))
{
.	$size[0] = $intMaxWidth;
.	$size[1] = floor($intMaxWidth * $objFile->height / $objFile->width);
85	}
86
87	$src = $this->getImage($this->urlEncode($this->singleSRC), $size[0], $size[1], $size[2]);
88
89	if (($imgSize = `getimagesize(TL_ROOT . '/' . $src)) )== false)
.	{
.	$this->Template->imgSize = ' ' . $imgSize[3];
}

$this->Template->src = $src;
$this->Template->alt = specialchars($this->alt);
$this->Template->title = specialchars($this->linkTitle);
$this->Template->caption = $this->caption;
}
}

```

--- _Originally created by renderart on February 19th, 2010, at 01:14pm (ID 1585)_