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

    Font bastardo su imagettftext();

    Salve,
    non riesco ad assegnare un altro font che non sia un nome singolo, se metto "Arial Black" non funziona piu', mi sapete dire come mai ???

    Error:
    -----------------
    Warning: imagettftext() [function.imagettftext]: Could not find/open font

    codice:
    <?
    $string = "pippo!!!";
    
    $img = imagecreatefromgif("security_background2.gif");
    $colour1 = imagecolorallocate($img, 190, 190, 190);
    $colour2 = imagecolorallocate($img, 0, 0, 0);
    $font = 'Arial';
    $angle = rand(0, 0);
    
    imagettftext($img, 50, $angle, 13, 103, $colour2, $font, $string);
    imagettftext($img, 50, $angle, 10, 100, $colour1, $font, $string);
    
    imagegif($img, "myImgOut.gif");
    ?>
    
    [img]myImgOut.gif[/img]

    oppure :
    -----------------------------
    Esiste un altro modo per creare FISICAMENTE in immagine trasparente contenente la scritta che voglio io con il font che voglio io ???

  2. #2
    Utente di HTML.it
    Registrato dal
    Aug 2002
    Messaggi
    8,013
    C'è un warning a proposito dei nomi dei font per quella funzione:

    fontfile

    The path to the TrueType font you wish to use.

    Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.

    When using versions of the GD library lower than 2.0.18, a space character, rather than a semicolon, was used as the 'path separator' for different font files. Unintentional use of this feature will result in the warning message: Warning: Could not find/open font. For these affected versions, the only solution is moving the font to a path which does not contain spaces.

    In many cases where a font resides in the same directory as the script using it the following trick will alleviate any include problems.
    Potrebbe essere il tuo caso? Per prova, sposta il tuo "Arial Black.ttf" nella cartella dello script e prova a rinominarlo senza spazio per l'inclusione.
    <´¯)(¯`¤._)(¯`»ANDREA«´¯)(_.¤´¯)(¯`>
    "The answer to your question is: welcome to tomorrow"

  3. #3
    ha improvvisamente ricominciato a funzionare, ho riavviato il sistema....., BO!!!!

  4. #4
    Scusa,
    ho modificato lo script,
    in un file "PNG-24 transparent" ci scrivo dentro una frase,
    solo che il file PNG non mi prende la trasparenza, non capisco come mai......
    mi copre il "background" rosso del Body.....

    Codice PHP:
    <html>
    <head>
    <title></title>
    </head>
    <body bgcolor="#FF0000">

    <?
    $im 
    imagecreatefrompng("bg_transparent_png24.png");
    $text "Chi Siamo";
    $font 'ardleys.ttf';
    $sFileNameOutput "myImgOut.png";


    imagettftext($im100013105imagecolorallocate($im000), $font$text);
    imagettftext($im100010100imagecolorallocate($im190190190), $font$text);

    imagecolortransparent($im0);

    imagepng($im$sFileNameOutput);

    imagedestroy($im);
    ?>

    [img]<?=$sFileNameOutput ;?>[/img]

    </body>
    </html>

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.