Folgendes merkwürdiges Verhalten ist mir aufgefallen. Wenn aus einem Bild
ein Thumbnail erstellt werden soll und das sogenannte Crop / Cropping zum
Einsatz kommt, wird das Thumbnail ordentlich erstellt, aber der Hintergrund
in dem skaliertern Bild ist schwarz.
Das tritt natrürlich nur dann auf, wenn ein Bild zb. 150x480px auf ein Thumb-
nail von 140x110Px skaliert bzw. skaliert und "gecropt" wird.
Siehe Bild:
Die Datei die dafür zuständig ist -> "functions.api.images.php" aus
dem Verzeichnis serverpfad/contenido/includes/.
In Zeile 407 ist folgender Code:
Code: Alles auswählen
if ($crop)
{
/* Create the target image with the max size, crop it afterwards. */
$targetImage = imagecreatetruecolor($maxX, $maxY);
imagecopy($targetImage, $imageHandle, 0, 0, 0, 0, $maxX, $maxY);
} else {
/* Create the target image with the target size, resize it afterwards. */
$targetImage = imagecreatetruecolor($targetX, $targetY);
imagecopyresampled($targetImage, $imageHandle, 0, 0, 0, 0, $targetX, $targetY, $x, $y);
}
Nun habe ich folgenden Code probiert:
Code: Alles auswählen
if ($crop)
{
/* Create the target image with the max size, crop it afterwards. */
$targetImage = imagecreatetruecolor($maxX, $maxY);
$background = imagecolorallocate($targetImage, 255, 255, 255);
imagecopy($targetImage, $imageHandle, 0, 0, 0, 0, $maxX, $maxY);
imagefill($targetImage, 0, 0, $background);
} else {
/* Create the target image with the target size, resize it afterwards. */
$targetImage = imagecreatetruecolor($targetX, $targetY);
imagecopyresampled($targetImage, $imageHandle, 0, 0, 0, 0, $targetX, $targetY, $x, $y);
}
vor "imagecopy" setze.
Auch testweise "imagefilledrectangle" bringt keine Besserung.
Irgendwelche Ideen dazu?