Visualizzazione risultati 1 fino 13 di 13

Discussione: Elaborare un "Genera Loghi"

  1. #1
    Guest

    Cool Elaborare un "Genera Loghi"

    salve a tutti(è da 1 pò ke non ci si sente vero?)...cmq penso ke molti di voi conoscano CoolText un sito che crea dei "loghi" personalizzabili...
    ...ecco, vorrei che qualke buona anima mi facesse 1 cosa del genere(ma non uguale), dovrebbe metterci qualche carattere, il colore del testo e quello di sfondo.

    -Caratteri: Times New Roman, Arial, Arial Black, Comic Sans MS, Snap ITC, Virtual DJ, Batavia
    -Colori Sfondo: Tutti i colori normali
    -Colori Testo: Tutti i colori normali

    Spero che la cosa sia fattibile, e che qualche buona anima mi realizzi sta cosa...grazie 1000!
    Ultima modifica di TurkoSoft : 20-12-2005 alle ore 16.53.22

  2. #2
    Guest

    Predefinito

    è da molto ke ti sento...

    cmq siccome ho la febbre e sto a casa a rompermi te lo faccio poi quando ho finito posto il codice

    ciao ^__^

    ----------------------------------

    Ho finito:

    file: index.php
    Codice PHP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Creazione Loghi</title>
    <script type="text/javascript">
    function add_color(c, c1, c2)
    {
    document.modulo.c.value = c;
    document.modulo.c1.value = c1;
    document.modulo.c2.value = c2;
    }
    </script>
    </head>
    <body>
    <?
    $dir
    = './img/';
    $dirs = './font/';
    $img = '';
    $font = '';
    $a = 0;
    $b = 0;

    if(
    $handle = opendir($dir) )
    {
    while(
    $file = readdir($handle) )
    {
    if(
    $file != '.' && $file != '..')
    {
    $imgs[] = $file;
    $img .= "<img src=\"{$dir}{$file}\" alt=\"\"><input type=\"radio\" name=\"img\" value=\"{$a}\"><br>\n";
    $a++;
    }
    }
    closedir($handle);
    }

    if(
    $hand = opendir($dirs) )
    {
    while(
    $read = readdir($hand) )
    {
    if(
    $read != '.' && $read != '..' )
    {
    $fonts[] = $read;
    $ext = strtolower(strrchr($read, '.'));
    $read = str_replace($ext, '', $read);
    $font .= "<option value=\"{$b}\">{$read}</option>\n";
    $b++;
    }
    }
    closedir($hand);
    }

    $color = array
    (
    '#000000' => '0, 0, 0',
    '#FFFFFF' => '255, 255, 255',
    '#0000FF' => '0, 0, 255',
    '#FF0000' => '255, 0, 0',
    '#00FF00' => '0, 255, 0',
    '#FFFF00' => '255, 255, 0',
    '#FF00FF' => '255, 0, 255',
    '#FFD700' => '255, 215, 0',
    '#FFC0CB' => '255, 192, 203',
    '#87CEEB' => '135, 206, 235',
    '#CCCCCC' => '204, 204, 204',
    '#999999' => '153, 153, 153'
    );
    $col = '';
    foreach(
    $color as $esa => $rgb)
    {
    $col .= "<span style=\"border:1px solid #000000; margin:5px; width=5px; height:5px; background-color:{$esa}; cursor:pointer;\" onclick=\"add_color($rgb)\">&nbsp;&nbsp;&nbsp;</span>";
    }

    if( isset(
    $_POST['status']) == false )
    {
    ?>
    <form action="<?=$PHP_SELF?>" method="post" name="modulo">
    <table align="center">
    <tr>
    <td>
    Immagine di sfondo:
    </td>
    <td>
    <?=$img?>
    </td>
    </tr>
    <tr>
    <td>
    Testo:
    </td>
    <td>
    <input type="text" name="text">
    </td>
    </tr>
    <tr>
    <td>
    Nome File:
    </td>
    <td>
    <input type="text" name="name">
    </td>
    </tr>
    <tr>
    <td>
    Font:
    </td>
    <td>
    <select name="font">
    <option value="">Scegli...</option>
    <?=$font?>
    </select>
    </td>
    </tr>
    <tr>
    <td>
    Colore Testo:
    </td>
    <td>
    <?=$col?>
    </td>
    </tr>
    <tr>
    <td align="center" colspan="2">
    <input type="text" readonly name="c" size="3"> <input type="text" readonly name="c1" size="3"> <input type="text" readonly name="c2" size="3">
    </td>
    </tr>
    <tr>
    <td>
    &nbsp;
    </td>
    <td>
    <input type="submit" name="sub" value="Invia"><input type="hidden" name="status" value="ok">
    </td>
    </tr>
    </table>
    </form>
    <?
    }
    else
    {
    $text = $_POST['text'];
    $pimg = $_POST['img'];
    $c = $_POST['c'];
    $c1 = $_POST['c1'];
    $c2 = $_POST['c2'];
    $pfont = $_POST['font'];
    $name = $_POST['name'];

    if(
    $text == '' || $pimg == '' || $c == '' || $c1 == '' || $c2 == '' || $pfont == '' || $name == '')
    {
    die(
    'Tutti i campi sono obbligatori');
    }

    $stat = getimagesize($dir . $imgs[$pimg]);
    $ar = 'archive/';
    if(
    file_exists($ar) == false)
    {
    mkdir($ar, 0777);
    }

    if(
    file_exists($ar . $name . '.gif') == false)
    {
    $im = imagecreatefromgif($dir . $imgs[$pimg]);
    $cl = imagecolorallocate($im, $c, $c1, $c2);
    imagettftext($im, 15, 0, ($stat[0]/3), ($stat[1]/1.5), $cl, $dirs . $fonts[$pfont], $text);
    if(
    imagegif($im, $ar . $name . '.gif') )
    {
    echo
    "L'immagine è stata creata con successo.<br>
    Anteprima: <img src=\"
    {$ar}{$name}.gif\" alt =\"\"><br>
    Link: <a href=\"
    {$ar}{$name}.gif\">$name</a>";
    }
    imagedestroy($im);
    }
    else
    {
    die(
    'Immagine già presente in archivio');
    }
    }
    ?>
    </body>
    </html>
    poi crei una cartella e chiamala font dentro ci metti tutti i font ke vuoi e un altra ke la kiami img dove ci metti le immagini di sfondo delle immagini...

    ecco il pacchetto zip: link

    cmq nel pacchetto nn ci sono tutti i font xke nn ce li avevo... x aggiungerne basta metterli nella cartella font...

    ciao ^__^
    Ultima modifica di jostock : 20-12-2005 alle ore 21.41.19

  3. #3
    Guest

    Cool

    ciao BIG jostock, in effetti è verissimo, è molto ke c sentiamo (cm no)
    per me è stato 1 colpo di cool ke hai la febbre( ) adesso ptesto tutto, poi t faccio sapere!

    --------------------------------
    rieccomi, e te pareva che qualcosa non andava, ecco la pagina: LOGHI fatemi sapere cosa non va, dato ke io di php non so 1 mazza!
    Altra cosa, come fa 1 user a scegliere l'immagine di sfondo, se non c'è manco 1 bottone dove andarla a prendere?
    Ultima modifica di TurkoSoft : 20-12-2005 alle ore 22.01.11

  4. #4
    Guest

    Predefinito

    le immagini le devi mettere nella cartella img e poi appariranno con vicino anke un bottone x scegliere l'immagine
    se prendevi il pacchetto già cerano i font e alcune immagini x prova...

    ciao ^__^

  5. #5
    Guest

    Cool

    mitico jo...ma se invece l'immagine la voglio rendere con sfondo trasprente, devo metterci 1 immagine trasparente?
    altra cosa, vorrei che l'immagine(se il testo è lungo) si moltiplicasse...
    -----------
    cose da aggiungere:

    - opzione edita
    - immagine che si moltiplica
    - opzione larghezza
    - opzione altezza
    - mettere le immagini in 1 pagina a parte

    GRAZIE!
    Ultima modifica di TurkoSoft : 20-12-2005 alle ore 22.28.45

  6. #6
    Guest

    Predefinito

    ora mi rimetto a lavoro cmq ci sono alcuni problemi:

    - l'immagine nn puo essere + editata, al massimo posso togliere il controllo sui file già esistenti e cosi uno la può rifare con lo stesso nome
    - questo nn si puo fare, si puo solo modificare la grandezza
    - non c'è problema
    - non c'è problema
    - farò anke questo

    ciao ^__^

  7. #7
    Guest

    Cool

    qnd hai finito fammi 1 zip e mandalo x pm please!...miticoz!

  8. #8
    Guest

    Predefinito

    sto ancora lavorando ma c'è un problema con le gd nel ridimensionamento delle immagini ecco il codice:
    Codice PHP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Creazione Loghi</title>
    <script type="text/javascript">
    function add_color(c, c1, c2)
    {
    document.modulo.c.value = c;
    document.modulo.c1.value = c1;
    document.modulo.c2.value = c2;
    }
    </script>
    <style type="text/css">
    body
    {
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:10px;
    }
    table
    {
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:10px;
    }
    a
    {
    color:#0000FF;
    background-color:#FFFFFF;
    text-decoration:none;
    }
    a:hover
    {
    color:#000000;
    background-color:#FFFFFF;
    text-decoration:underline;
    }
    </style>
    </head>
    <body>
    <?
    $dirs
    = './font/';
    $img = '';
    $font = '';
    $b = 0;
    $dir = './img/';

    if(
    $handle = opendir($dir) )
    {
    while(
    $file = readdir($handle) )
    {
    if(
    $file != '.' && $file != '..')
    {
    $imgs[] = $file;
    }
    }
    closedir($handle);
    }

    if(
    $hand = opendir($dirs) )
    {
    while(
    $read = readdir($hand) )
    {
    if(
    $read != '.' && $read != '..' )
    {
    $fonts[] = $read;
    $ext = strtolower(strrchr($read, '.'));
    $read = str_replace($ext, '', $read);
    $font .= "<option value=\"{$b}\">{$read}</option>\n";
    $b++;
    }
    }
    closedir($hand);
    }

    $color = array
    (
    '#000000' => '0, 0, 0',
    '#FFFFFF' => '255, 255, 255',
    '#0000FF' => '0, 0, 255',
    '#FF0000' => '255, 0, 0',
    '#00FF00' => '0, 255, 0',
    '#FFFF00' => '255, 255, 0',
    '#FF00FF' => '255, 0, 255',
    '#FFD700' => '255, 215, 0',
    '#FFC0CB' => '255, 192, 203',
    '#87CEEB' => '135, 206, 235',
    '#CCCCCC' => '204, 204, 204',
    '#999999' => '153, 153, 153'
    );
    $col = '';
    foreach(
    $color as $esa => $rgb)
    {
    $col .= "<span style=\"border:1px solid #000000; margin:5px; width=5px; height:5px; background-color:{$esa}; cursor:pointer;\" onclick=\"add_color($rgb)\">&nbsp;&nbsp;&nbsp;</span>";
    }

    if( isset(
    $_POST['status']) == false )
    {
    ?>
    <form action="<?=$PHP_SELF?>" method="post" name="modulo">
    <table align="center">
    <tr>
    <td>
    Immagine di sfondo:
    </td>
    <td align="center">
    <a href="#" onClick="window.open('img.php', 'img', 'width=400, height=400, status=no, resizable=no,top=20,left=250')">Visualizza</a>
    </td>
    </tr>
    <tr>
    <td>
    Dimensione Immagine:
    </td>
    <td>
    Larghezza: <input type="text" name="wh"><br>
    Altezza: &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="hh" style="margin-top:2px; position:relative; left:1px;">
    </td>
    </tr>
    <tr>
    <td>
    Testo:
    </td>
    <td>
    <input type="text" name="text">
    </td>
    </tr>
    <tr>
    <td>
    Nome File:
    </td>
    <td>
    <input type="text" name="name">
    </td>
    </tr>
    <tr>
    <td>
    Font:
    </td>
    <td>
    <select name="font">
    <option value="">Scegli...</option>
    <?=$font?>
    </select>
    </td>
    </tr>
    <tr>
    <td>
    Colore Testo:
    </td>
    <td>
    <?=$col?>
    </td>
    </tr>
    <tr>
    <td align="center" colspan="2">
    <input type="text" readonly name="c" size="3"> <input type="text" readonly name="c1" size="3"> <input type="text" readonly name="c2" size="3">
    </td>
    </tr>
    <tr>
    <td>&nbsp;

    </td>
    <td>
    <input type="submit" name="sub" value="Invia"><input type="hidden" name="status" value="ok">
    </td>
    </tr>
    </table>
    </form>
    <?
    }
    else
    {
    session_start();
    $text = $_POST['text'];
    $pimg = $_SESSION['img'];
    $c = $_POST['c'];
    $c1 = $_POST['c1'];
    $c2 = $_POST['c2'];
    $pfont = $_POST['font'];
    $name = $_POST['name'];
    $wh = $_POST['wh'];
    $hh = $_POST['hh'];
    $stat = getimagesize($dir . $imgs[$pimg]);

    if(
    $text == '' || $pimg == '' || $c == '' || $c1 == '' || $c2 == '' || $pfont == '' || $name == '' || $wh == '' || $hh == '')
    {
    die(
    'Tutti i campi sono obbligatori');
    }

    if(
    $wh > $stat[0])
    {
    if(
    strlen($text) >= 5 )
    {
    $new_wh = strlen($text) * 15;
    if(
    $new_wh < $wh )
    {
    $new_wh = $wh;
    }
    }
    else
    {
    $new_wh = $wh;
    }
    }
    else
    {
    die(
    'Dimensione immagine troppo piccola');
    }
    $new_hh = $hh;

    $ar = 'archive/';
    if(
    file_exists($ar) == false)
    {
    mkdir($ar, 0777);
    }

    if(
    file_exists($ar . $name . '.gif') == false )
    {

    $im = imagecreatefromgif($dir . $imgs[$pimg]);
    $thimg = imagecreate($new_wh, $new_hh);
    imagecolorallocate($thimg, 255, 255, 255);
    imagecolorallocate($im, 255, 255, 255);
    $cl = imagecolorallocate($thimg, $c, $c1, $c2);

    imagecopyresized($thimg, $im, 0, 0, 0, 0, $new_wh, $new_hh, $wh, $hh);
    imagettftext($thimg, 15, 0, ($stat[0]/3), ($stat[1]/1.5), $cl, $dirs . $fonts[$pfont], $text);

    if(
    imagegif($thimg, $ar . $name . '.gif') )
    {
    echo
    "L'immagine è stata creata con successo.<br>
    Anteprima: <img src=\"
    {$ar}{$name}.gif\" alt =\"\"><br>
    Link: <a href=\"
    {$ar}{$name}.gif\">$name</a>";
    }
    imagedestroy($im);
    imagedestroy($thimg);
    }
    else
    {
    die(
    'Immagine già presente in archivio');
    }
    @
    session_destroy('img');
    }
    ?>
    </body>
    </html>
    se qualcono riesce a risolverlo xke ci sto sbattendo la testa da un po e nn funziona ancora...

    ciao ^__^
    Ultima modifica di jostock : 22-12-2005 alle ore 13.51.50

  9. #9
    Guest

    Cool

    cosa sono ste gd?

  10. #10
    Guest

    Predefinito

    sono le librerie ke modificano le immagini e fanno anke altre cose...

  11. #11
    Guest

    Cool

    senti ma ho visto ke le immagini dovrei farle visualizzare in una pagina kiamata img.php?...non ho ben capito!

  12. #12
    Guest

    Predefinito

    si hai capito bene

    ciao ^__^

  13. #13
    Guest

    Cool

    si, ma poi come faccio a farle selezionare?

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •