habe das modul "gerenderte überschrift" erfolgreich in verwendung und habe meinem kunden nun ein kombiniertes modul zusammengeflickt, das aus einem bild, einer gerenderten überschrift, einem textile (nur text) und einem link-modul besteht.
leider bringt er nun bei der bildnummern-vergabe der überschriften einiges durcheinander, so dass manchmal in einem artikel bei mehreren überschriften teilweise dasselbe überschrift-bild zweimal geladen wird, überschriften durcheinandergeraten etc.
ich vermute, der fehler liegt irgendwo in der modul ausgabe..aber wo..
(...)
Code: Alles auswählen
<div class="spalte_2">
<?php
$name = ereg_replace("([^_A-Za-z0-9\.-])","","REX_VALUE[6]");
$text = "REX_VALUE[6]";
$color = "REX_VALUE[10]";
$bgcolor = "ffffff";
$slice_id = strlen( "REX_VALUE[7]" ) == 0 ? $_POST["slice_id"] : "REX_VALUE[7]";
$imgsrc = REX_CATEGORY_ID ."_". REX_ARTICLE_ID ."_". $slice_id ."_". $REX['LANG'] .".png";
$font = $REX[INCLUDE_PATH]."/ttf/REX_VALUE[8].ttf";
$fontsize = (int)"REX_VALUE[9]";
$imgfile = $REX[INCLUDE_PATH]."/../../pics/headlines/$imgsrc";
// save
if( $_POST["save"] == 1 ) {
// create Image
$abox = imagettfbbox( $fontsize, 0, $font, "A" );
$bbox = imagettfbbox( $fontsize, 0, $font, $text );
$width = 1 + abs(min($bbox[2], $bbox[4])-max($bbox[0],$bbox[6]));
$height = abs(min($bbox[5],$bbox[7])-max($bbox[1],$bbox[3]));
$xpos = 0; //-1 * min($bbox[0],$bbox[6]);
$ypos = abs(max($abox[5],$abox[7]));
$im = imagecreatetruecolor( $width, $height );
$clr = imagecolorallocate( $im, intval("0x". substr( $color, 0, 2 ), 16), intval("0x". substr( $color, 2, 2 ), 16), intval("0x". substr( $color, 4, 2 ), 16 ));
$bgclr = imagecolorallocate( $im, intval("0x". substr( $bgcolor, 0, 2 ), 16), intval("0x". substr( $bgcolor, 2, 2 ), 16), intval("0x". substr( $bgcolor, 4, 2 ), 16 ));
imagefilledrectangle( $im, 0, 0, $width, $height, $bgclr );
imagettftext($im, $fontsize, 0, $xpos, $ypos, $clr, $font, $text );
imagepng( $im, $imgfile );
imagedestroy( $im );
}
// output
list( $width, $height, $info, $attr ) = getimagesize( $imgfile );
echo '<img style="'. "REX_VALUE[6]" .'" src="/pics/headlines/'. $imgsrc .'" alt="'. $text .'" title="'. $text .'" '. $attr .'><br /><br />';
?>
zusätzlich gibt es in der modul-eingabe dieses versteckte feld, das die slice-id übermittelt..
Code: Alles auswählen
<input type="hidden" name="VALUE[7]" value="<?=$_GET['slice_id']?>">