• User Attivo

    Decidere allineamento, grassetto, ecc... nelle immagini dinamiche fatte da php

    Ciao a tutti,

    ho cercato mezzo web ma non ho trovato niente che mi soddisfava :gtsad:

    Quello che vorrei fare è creare immagini dinamiche con php però specificando gli attributi: grassetto, corsivo, sottolineato, allineamento (sinistra, centro e destra), e gli altri attributi. :wink3:

    Mi sapete dire come fare? :smile5:

    Grazie :smile5:

    :gthi:


  • Bannato User Attivo

    A quanto pare non sono funzionalità incluse nelle GD, per cui dovrai "arrangiarti" con metodi custom.
    Per quanto ho capito leggendo a destra e a manca, per il tipo di carattere (bold, italic, ect.) devi usare set di font differenti già in bold, italic, ect; per l'allineamente devi sbattere un pò la testa con le dimensioni dell'immagine, del carattere, il numero di caratteri ect. e allineare il testo in base a queste informazioni.

    per l'allineamento ho trovato questo:
    it.php.net/imagettfbbox
    ci trovi degli esempi in proposito.


  • User Attivo

    Hai ragione, ci sono i font alterati (stessi) con grassetto, corsivo, ma sottolineato? (quello che mi serve)

    Ho visto la funzione imagettfbbox che scrive e restituisce un'array di 8 elementi 😉

    :gthi:


  • Bannato User Attivo

    ho trovato questo per l'underline:
    it.php.net/manual/it/ref.image.php#69016

    In addition to %0A which you can use for making multiline text images, you can also use underlining and strikethrough.

    For underlining use %0D and _, for example:

    /image.php?text=Underline.%0D________

    For strikethrough use %0D and %E2%80%93, for example:

    /image.php?text=Strikethrough.%0D%E2%80%93%E2%80%93%E2%80%93%E2%80%93
    %E2%80%93%E2%80%93%E2%80%93%E2%80%93%E2%80%93%E2%80%93

    If you want to use both of them in one line you will have to use %20 to dispose the next block of modifying symbols:

    /image.php?text=Underline%20and%20Strikethrough.%0D_______%20%20%20%20
    %20%20%20%20%20%E2%80%93%E2%80%93%E2%80%93%E2%80%93%E2%80%93%E2%80%93
    %E2%80%93%E2%80%93%E2%80%93%E2%80%93

    As you see all modifying symbols for whole line are put after %0D in one string after the whole modifyable text and not after each modifyable word. This makes easy to put on and take off modifying string for whole line when it`s necessary.

    If the text is on several lines, each line has its own disposition of modifying symbols:

    /image.php?text=Underline%20and%0D_______%0AStrikethrough.%0D%E2%80%93
    %E2%80%93%E2%80%93%E2%80%93%E2%80%93%E2%80%93%E2%80%93%E2%80%93
    %E2%80%93%E2%80%93

    Theese are only some examples how to use symbol combining. Using %0D and other symbols from Windows Charmap you can easy make images of characters which even doesn`t exist in any font.non mi convince tanto come soluzione e non so se funziona, altrimenti, come qualcuno suggerisce in rete, l'underline è una linea basta disegnarla sotto ogni carattere 😉 detto così sembra semplice, ma se non si trova in giro uno script già pronto ti ci voglio a sbatterti a disegnare una linea sotto il carattere 😄


  • ModSenior

    Prendi un font con una riga sotto le lettere e fai prima 😄


  • User Attivo

    lol

    Comunque ho creato un font con il programma e alterando un font iniziale mettendoci la linea sotto 😄 e quindi trasformandolo in sottolineato 😄

    :gthi: