Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Problema creazione immagine con GD

    Salve a tutti io stò cercando di farmi una firma dinamica, allora voglio inserire all'interno di questa immagine dinamica alcune info sul mio forum.
    Allora ho creato la pagina che interroga il database e la pagina che crea l'immagine.

    Però ho un problema se nella pagina che creò l'immagine (poi posterò i codice) metto include(pagina_che_interroga_il_db) non mi visualizza niente come se l'intestazione non partisse correttamente.

    Allora tolgo l'include e tutto funziona... Non capisco il perchè...

    Ecco gli script:
    Pagina che interroga il db:
    Codice PHP:
    //
    // Setup the relative path to your phpBB folder...
    //
    $phpbb_root_path '../../phpBB-2.0.11/phpBB2/';

    // 
    // Initialize phpBB and user session...
    //
    define('IN_PHPBB'true);
    include(
    $phpbb_root_path .'extension.inc');
    include(
    $phpbb_root_path .'common.'.$phpEx);
    $userdata session_pagestart($user_ipPAGE_INDEX);
    init_userprefs($userdata);

    //
    // Get the list of forums the current user is allowed to view...
    //
    $is_auth_ary auth(AUTH_VIEWAUTH_LIST_ALL$userdata);
    $auth_data_sql '';
    foreach( 
    $is_auth_ary as $fid => $is_auth_row )
    {
        if( 
    $is_auth_row['auth_view'] )
        {
            
    $auth_data_sql .= ( $auth_data_sql != '') ? ', ' $fid $fid;
        }
    }
    if( empty(
    $auth_data_sql) )
    {
        
    $auth_data_sql = -1;
    }

    //
    // Retrieve the latest active topic title...
    //
    $sql "SELECT t.topic_title, u.username, p.post_time
        FROM "
    TOPICS_TABLE ." AS t,
            "
    FORUMS_TABLE ." AS f,
            "
    USERS_TABLE ." AS u,
            "
    POSTS_TABLE ." AS p
        WHERE f.forum_id = t.forum_id
            AND t.topic_last_post_id = p.post_id
            AND p.poster_id = u.user_id
            AND f.forum_id in ( 
    $auth_data_sql )
        ORDER BY t.topic_last_post_id DESC
        LIMIT 1"
    ;
    if( !(
    $result $db->sql_query($sql)) || !($row $db->sql_fetchrow($result)) )
    {
    //    Uncomment the following line for debug purposes ;-)
    //    message_die(GENERAL_ERROR, 'Could not query DB', '', __LINE__, __FILE__, $sql);
        
    $text = array(
            
    "Errore nella richiesta delle informazioni.",
            
    ""
        
    );
    }
    else
    {
        
    $post_date create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
        
    $text = array(
            
    "Ultimo post scritto da: " $row['username'] . ', ' $post_date,
            
    "Titolo: " $row['topic_title']
        );

    La pagina che crea l'immagine:
    Codice PHP:
    $gdfonts = array(
        
    '8x13iso''9x15iso''andale12''atommicclock''bmreceipt',
        
    'chowfun''courier8''dimurph''georgia8''proggyclean',
        
    'proggysquare''systemex''terminal6''trisk'
    );

    //
    //
    //
    if( !isset($image_info) || !isset($image_text) )
    {
        exit;
    }

    //
    //
    //
    $sz = @getimagesize('./images/'.$image_info['image']);
    if( !
    $sz )
    {
        exit;
    }
    $image_w $sz[0];
    $image_h $sz[1];

    //
    //
    //
    @header('Content-type: image/png');

    $im = @imagecreatefromgif('./images/'.$image_info['image']);
    $rgb = ( isset($image_info['color']) ? $image_info['color'] : array(255255255) );
    $bgColor imagecolorallocate($im$rgb[0], $rgb[1], $rgb[2]);

    for( 
    $i 0$i count($image_text); $i++ )
    {
        if( !
    is_numeric($image_text[$i]['font']) )
        {
            
    $font 1;
        }
        else if( 
    $image_text[$i]['font'] < )
        {
            
    $font $image_text[$i]['font'] * -1;
        }
        else
        {
            if( !(
    $font = @imageloadfont('./gd_fonts/'.$gdfonts[$image_text[$i]['font']].'.gdf')) )
            {
                
    $font 1;
            }
        }
        
    $rgb $image_text[$i]['color'];
        
    $fgColor imagecolorallocate($im$rgb[0], $rgb[1], $rgb[2]);
        
    imagestring($im$font$image_text[$i]['x'], $image_text[$i]['y'], $image_text[$i]['text'], $fgColor);
    }

    imagepng($im);
    imagedestroy($im); 
    Mentre ecco la pagina in cui tutto viene richiamato:
    Codice PHP:
    include('./firmadb.php');

    $text1 $text[0];
    $text2 $text[1];

    $image_info = array( 
        
    'image'    => 'oreblait.gif' 
    ); 

    $image_text = array(
        array( 
            
    'x'     => 3
            
    'y'     => 5
            
    'color' => array(50100180), 
            
    'font'  => 9
            
    'text'  => "Ciao" 
        
    ),
        array(
            
    'x'     => 8,
            
    'y'     => 15,
            
    'color' => array(50100180),
            
    'font'  => 9,
            
    'text'  => "Prova"
        
    )
    );

    include(
    './includes/dynamic_gd_image.php5'); 

  2. #2
    sai, anche io ho lo stesso problema...

    leggi il mio post che ho appena inserito.. magari troviamo una soluzione insieme..
    http://forum.html.it/forum/showthrea...hreadid=829593

    ciao ste

  3. #3
    Ok guarderò anche in quel post anche se mi sembra un po diverso.

  4. #4
    si guardalo ora che c'è la soluzione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.