Visualizzazione dei risultati da 1 a 5 su 5

Discussione: Generatore favicon

  1. #1

    Generatore favicon

    Ragazi salve a tutti.
    Ho trovato su questo sito uno script che da la possibilità di generare una favicon da un'altra immagine in formato jpg. Solo che non funziona.
    Questo è l'errore che mi da:
    Warning: move_uploaded_file(uploads/prova.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in D:\Inetpub\webs\robyonwebcom\robyonweb\area_webmas ter\strumenti_webmaster\favicon.php on line 19

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\PHP\upload\phpFFAD.tmp' to 'uploads/prova.jpg' in D:\Inetpub\webs\robyonwebcom\robyonweb\area_webmas ter\strumenti_webmaster\favicon.php on line 19

    E questo è invece il codice della pagina:
    Codice PHP:
    <?
    // Where the file is going to be placed 
    $target_path "uploads/";

    /* Add the original filename to our target path.  
    Result is "uploads/filename.extension" */
    $target_path $target_path basename$_FILES['uploadedfile']['name']); 
    $_FILES['uploadedfile']['tmp_name'];  
    // If we have uploaded correctly...

    $extensions = array("JPG","jpg","JPEG","jpeg"); //File Types

    $check $target_path;

    $explosion explode("."$check);
    $name $explosion[0]; //This is the real name of the file
    $extension $explosion[1]; //This is the extension of the full file

    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {

    if (!
    in_array($extension$extensions)) {
    echo  
    "You have to upload a file ending in .jpg in order for us to generate your favicon";
    unlink ($target_path); // delete the original file
    } else {

        echo 
    "We have successfully generated your icon!
    "
    ;
        
    // Now actually generate it
    $im imagecreatefromjpeg($target_path);
    list(
    $width$height) = getimagesize($target_path); // get the width and height of the jpg
    $image_p imagecreatetruecolor("16""16"); // create a 16x16 canvas to play with
    imagecopyresampled($image_p$im0000"16""16"$width$height); // resize jpg to 16x16
    $num rand (1,99999); // generate a random number between 1 and 99999
    $output $num."-favicon.ico"// add the number to a string with -favicon.ico
    imagepng($image_p,$output); // make a .png file (icon file) from our data
    imagedestroy ($im); // close gd library
    echo "<a href= \"http://www.swansoninternet.com/phpincludes/$output\"><img src = \"http://www.swansoninternet.com/phpincludes/$output\">
    Clicca qui</a> o sull'immagine per scaricare la favicon."
    // show our icon with information
    unlink ($target_path); // delete the original file
    }

    } else{
        echo 
    "Upload a .jpg file to convert it to a favicon!";
    }

    ?>
    <title>Favicon Generator</title>
    <style type="text/css">
    <!--
    body,td,th {
        font-family: Tahoma, Helvetica, sans-serif;
        font-size: small;
        color: #666666;
    }
    -->
    </style><form enctype="multipart/form-data" action="<? $_SERVER['PHP_SELF']; ?>" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    Carica il file: <input name="uploadedfile" type="file" />

    <input type="submit" value="Create Favicon" />
    </form>

    Questa è la linea 19 che da il problema:
    Codice PHP:
    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { 
    Vi ringrazio in anticipo per la partecipazione
    ciao a tutti
    steave67

  2. #2
    La cartella di destinazione ha i corretti privilegi di scrittura?

  3. #3
    non so come si può vedere??
    Comunque c'era anche questo file (readme.txt) che dice questo:
    www.swansoninternet.com
    Favicon.ico generator

    Create a folder named uploads and chmod it to 777 . Run the script, it should work.

    La cartella l'ho creata solo che non capisco la parte in grassetto.

  4. #4
    è molto chiaro come dice filippo toso, devi avere i privilegi sulla cartella.
    le istruzioni dicono di mette chmod a 777 ovvero permesso di scrittura e lettura sulla cartella

    (ma come si mette chmod a 777 !?!?!?!? XD)
    Cerco Sviluppatori Flash: http://forum.html.it/forum/showthread.php?threadid=1418906

  5. #5
    e infatti è quello che non capisco: come si mettono questi permessi alla cartella???

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.