jiriki: GD-Bib: Erzeugen von Bild klappt nur offline, nicht online

Beitrag lesen

Noch mal die Frage: Gibt es das Bild-generierende Script mal online zu sehen?

Gerne.

Aufrufender Links aus my_paid_items.php:
--

  
<form method="post" action="print.php" name="print_bills" target="_blank">  
  <input type="image" src="Pics/Members/list_paid_items.png" style="border-width: 0px;" name="print" />  
</form>  

--

print.php:
--

  
<?php  
session_start();  
if( isset( $_SESSION[ "username" ] ) && isset( $_SESSION[ "password" ] ) )  
{  
  include( "Docs/Members/members_print_bill.php" );  
}  
?>  

--

members_print_bill.php:
Kurze Erklärung:
Zuerst ruft PHP die Informationen bezüglich des Mitglieds und seiner Pferde ab, für die im aktuellen Jahr bezahlt wurden. Dann werden die Daten kurz formatiert und anschließend das Bild mit Vorlage des "wappen.jpg" ausgegeben.
--

  
<?php  
  
// Ausgabe des Dokumenttyps  
header( "Content-type: image/jpeg" );  
  
require_once( "data.php" );  
  
// Starte DB-Anbindung  
$link = mysql_connect( $mysql_server, $mysql_user, $mysql_pw );  
mysql_select_db( $db_name, $link ) or die( "Datenbank konnte nicht gefunden werden." );  
  
// Adresse des Kunden / Mitglieds  
// ************************************************************************************************************  
$fields = array( "fname", "lname", "farm", "street", "zip", "city", "state" );  
$query = "SELECT ";  
            foreach( $fields as $var ) $query .= "u.".$var.", ";  
            for( $i=0; $i<count( $fields )-1; $i++ ) $query .= "tu.".$fields[$i]." as tu_".$fields[$i].", ";  
$query .=   "tu.".$fields[ $i ]." as tu_".$fields[$i]."  
            FROM m_user as u LEFT JOIN m_temp_user as tu ON ( u.ownerno = tu.ownerno AND ( tu.status = \"data_change\" OR tu.status = \"registered\" ) )  
            WHERE u.ownerno = \"".$_SESSION[ "ownerno" ]."\"  
            ORDER BY tu.applied DESC;";  
  
  
$temp = mysql_query( $query );  
$result = mysql_fetch_array( $temp, MYSQL_ASSOC );  
  
$query = "SELECT name, regnumber FROM stallions WHERE ownerno = \"".$_SESSION[ "ownerno" ]."\" AND paid REGEXP DATE_FORMAT( CURDATE(), \"%y\" );";  
$temp_stallions = mysql_query( $query );  
$query = "SELECT name, regnumber FROM m_regist_mares WHERE ownerno = \"".$_SESSION[ "ownerno" ]."\" AND paid REGEXP DATE_FORMAT( CURDATE(), \"%y\" );";  
$temp_mares = mysql_query( $query );  
  
$data = array();  
foreach( $fields as $var )  
{  
  $data[ $var ] = !empty( $result[ "tu_".$var ] ) ? $result[ "tu_".$var ] : $result[ $var ];  
}  
  
$address = array();  
$name = array();  
  
if(! empty( $data[ "farm" ] ) ) array_push( $address, $data[ "farm" ] );  
if(! empty( $data[ "fname" ] ) ) array_push( $name, $data[ "fname" ] );  
if(! empty( $data[ "lname" ] ) ) array_push( $name, $data[ "lname" ] );  
if( count( $name ) > 0 ) array_push( $address, implode( " ", $name ) );  
if(! empty( $data[ "street" ] ) ) array_push( $address, $data[ "street" ] );  
  
if( strtoupper( trim( $data[ "zip" ] ) ) == "CANADA" )  
{  
  if( preg_match( "!^([\w\s\.\-áàéèêíìîóòúùåçõãïø]+)\s*,\s*(\w+)\s+(\w[\w\s]+\w)\s*$!", $data[ "city" ], $result ) )  
  {  
    $data[ "city" ] = $result[1];  
    $data[ "state" ] = $result[2];  
    $data[ "zip" ] = $result[3];  
    $data[ "country" ] = "CANADA";  
  }  
}  
array_push( $address, $data[ "city" ].", ".$data[ "state" ]." ".$data[ "zip" ] );  
if( isset( $data[ "country" ] ) )  
  array_push( $address, $data[ "country" ] );  
// ************************************************************************************************************  
  
$pic_path = "Pics/Members/wappen.jpg";  
$pic_info = getimagesize( $pic_path );  
$pic_width = $pic_info[0];  
$pic_height = $pic_info[1];  
  
$image = imagecreatefromjpeg( $pic_path );  
  
$color_white = imagecolorallocate($image, 255, 255, 255);  
$color_grey = imagecolorallocate($image, 192, 192, 192);  
$color_blue = imagecolorallocate($image, 0, 0, 255);  
$color_black = imagecolorallocate($image, 0, 0, 0);  
  
// Dokumentrahmen  
// ***************************  
// Zeichne Rahmen  
imageline( $image, 1, 1, 1, ( $pic_height-1 ), $color_blue);  
imageline( $image, 1, 1, ( $pic_width-1 ), 1, $color_blue);  
imageline( $image, ( $pic_width-1 ), 1, ( $pic_width-1 ), ( $pic_height-1 ), $color_blue);  
imageline( $image, 1, ( $pic_height-1 ), ( $pic_width-1 ), ( $pic_height-1 ), $color_blue);  
  
$current_line = 20;  
  
// Dokumentkopf  
imagestring( $image, 5, 98, $current_line, $firma1." / ".$firma2, $color_black );  
imageline( $image, 20, $current_line+20, $pic_width-20, $current_line+20, $color_black);  
imagestring( $image, 3, 20, $current_line+25, $street, $color_black );  
imagestring( $image, 3, 20, $current_line+40, $place, $color_black );  
imagestring( $image, 3, 340, $current_line+25, "phone:", $color_black ); imagestring( $image, 3, 400, 45, $phone, $color_black );  
imagestring( $image, 3, 340, $current_line+40, "fax:", $color_black ); imagestring( $image, 3, 400, 60, $fax, $color_black );  
imagestring( $image, 3, 730, $current_line+25, "date:", $color_black ); imagestring( $image, 3, 781, 45, date( "m/d/Y" ), $color_black );  
  
// Anschrift des Mitglieds  
// *******************************  
// Rahmen  
$current_line += 80;  
imagestring( $image, 5, 20, $current_line, "Member:", $color_black );  
imageline( $image, 20, $current_line+20, 380, $current_line+20, $color_blue);  
imageline( $image, 20, $current_line+20, 20, $current_line+20+count( $address ) * 25, $color_blue);  
imageline( $image, 20, $current_line+20+count( $address ) * 25, 380, $current_line+20+count( $address ) * 25, $color_blue);  
imageline( $image, 380, $current_line+20+count( $address ) * 25, 380, $current_line+20, $color_blue);  
  
// Inhalt  
$current_line += 30;  
foreach( $address as $var )  
{  
  imagestring( $image, 5, 30, $current_line, $var, $color_black );  
  $current_line += 20;  
}  
  
// Preisliste  
// *******************************  
// Rahmen  
$current_line -= count( $address ) * 20 + 30;  
  
imagestring( $image, 5, 500, $current_line, "Late fees (if paid after April 1st):", $color_black );  
imageline( $image, 500, $current_line+20, 780, $current_line+20, $color_blue);  
imageline( $image, 500, $current_line+20, 500, $current_line+20+3 * 25, $color_blue);  
imageline( $image, 500, $current_line+20+3 * 25, 780, $current_line+20+3 * 25, $color_blue);  
imageline( $image, 780, $current_line+20+3 * 25, 780, $current_line+20, $color_blue);  
  
// Inhalt  
imagestring( $image, 5, 510, $current_line+30, "Membership:", $color_black );  
imagestring( $image, 5, 720, $current_line+30, "100.-", $color_black );  
imagestring( $image, 5, 510, $current_line+50, "Mare:", $color_black );  
imagestring( $image, 5, 729, $current_line+50, "60.-", $color_black );  
imagestring( $image, 5, 510, $current_line+70, "Stallion:", $color_black );  
imagestring( $image, 5, 720, $current_line+70, "400.-", $color_black );  
  
  
$current_line += 40+count( $address )*20+30;  
  
imagestring( $image, 5, 20, $current_line, "This invoice (all fees on this page are listed in US$):", $color_black );  
  
$current_line += 35;  
  
$total_amount = 0;  
$total_items = 0;  
  
$costs_member = 80;  
$costs_stallion = 300;  
$costs_mare = 30;  
  
// Auflisten der bezahlten Posten  
if( strstr( $_SESSION[ "paid" ], date( "Y" ) ) )  
{  
  imagestring( $image, 5, 30, $current_line, "- Membership fee (".date("Y").")", $color_black );  
  imagestring( $image, 5, 770, $current_line, $costs_member.".-", $color_black );  
  $current_line += 20;  
  $total_amount += $costs_member;  
  $total_items++;  
}  
while( $stallion = mysql_fetch_array( $temp_stallions, MYSQL_ASSOC ) )  
{  
  imagestring( $image, 5, 30, $current_line, "- Annual fee for ".$stallion[ "name" ]." (".date("Y").")", $color_black );  
  imagestring( $image, 5, 761, $current_line, $costs_stallion.".-", $color_black );  
  $current_line += 20;  
  $total_amount += $costs_stallion;  
  $total_items++;  
}  
while( $mare = mysql_fetch_array( $temp_mares, MYSQL_ASSOC ) )  
{  
  imagestring( $image, 5, 30, $current_line, "- Annual fee for ".$mare[ "name" ]." (".date("Y").")", $color_black );  
  imagestring( $image, 5, 770, $current_line, $costs_mare.".-", $color_black );  
  $current_line += 20;  
  $total_amount += $costs_mare;  
  $total_items++;  
}  
  
$current_line -= $total_items*20+15;  
imageline( $image, 20, $current_line, $pic_width-20, $current_line, $color_blue);  
imageline( $image, 20, $current_line, 20, $current_line+15+$total_items * 20+15, $color_blue);  
imageline( $image, 20, $current_line+15+$total_items * 20+15, $pic_width-20, $current_line+15+$total_items * 20+15, $color_blue);  
imageline( $image, $pic_width-20, $current_line+15+$total_items * 20+15, $pic_width-20, $current_line, $color_blue);  
  
$current_line += $total_items*20+30+20;  
$length_total_amount = strlen( $total_amount );  
imageline( $image, 20, $current_line, $pic_width-20, $current_line, $color_blue);  
imageline( $image, 20, $current_line, 20, $current_line+30, $color_blue);  
imageline( $image, 20, $current_line+30, $pic_width-20, $current_line+30, $color_blue);  
imageline( $image, $pic_width-20, $current_line+30, $pic_width-20, $current_line, $color_blue);  
imagestring( $image, 5, 30, $current_line+6, "TOTAL:", $color_black );  
imagestring( $image, 5, 770-($length_total_amount-2)*9, $current_line+6, $total_amount.".-", $color_black );  
  
// Ausgabe des Bildes im Browser  
imagejpeg( $image );  
// Freigabe des Speicherplatzes  
imagedestroy( $image );  
  
mysql_close( $link );  
?>  

--

Und da es bei den andren Servern funktioniert, gehe ich davon aus, dass es keine syntaktischen Fehler hat.

Grüßle und Danke