Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309

    tradurre questo script?

    Salve a tutti, non conosco php, ma mi serve tradurre in vb.net, o almeno capire questo script fatto in php:
    Codice PHP:
    <?php

    error_reporting
    (0);
    /**
     * Get the width and height of the destination image
     * from the POST variables and convert them into
     * integer values
     */
    $w = (int)$_POST['width'];
    $h = (int)$_POST['height'];

    // create the image with desired width and height

    $img imagecreatetruecolor($w$h);

    // now fill the image with blank color
    // do you remember i wont pass the 0xFFFFFF pixels 
    // from flash?
    imagefill($img000xFFFFFF);

    $rows 0;
    $cols 0;

    // now process every POST variable which
    // contains a pixel color
    for($rows 0$rows $h$rows++){
        
    // convert the string into an array of n elements
        
    $c_row explode(","$_POST['px' $rows]);
        for(
    $cols 0$cols $w$cols++){
            
    // get the single pixel color value
            
    $value $c_row[$cols];
            
    // if value is not empty (empty values are the blank pixels)
            
    if($value != ""){
                
    // get the hexadecimal string (must be 6 chars length)
                // so add the missing chars if needed
                
    $hex $value;
                while(
    strlen($hex) < 6){
                    
    $hex "0" $hex;
                }
                
    // convert value from HEX to RGB
                
    $r hexdec(substr($hex02));
                
    $g hexdec(substr($hex22));
                
    $b hexdec(substr($hex42));
                
    // allocate the new color
                // N.B. teorically if a color was already allocated 
                // we dont need to allocate another time
                // but this is only an example
                
    $test imagecolorallocate($img$r$g$b);
                
    // and paste that color into the image
                // at the correct position
                
    imagesetpixel($img$cols$rows$test);
            }
        }
    }

    // print out the correct header to the browser
    header("Content-type:image/jpeg");
    // display the image
    imagejpeg($img""90);
    ?>
    Da quanto sono riuscito a capire, tramite post questo script riceve dei parametri, e dovrebbero essere width, height, px, per quanto riguarda width e height sono riuscito a intercettarli, mentre il valore px mi dice che è null, ho provato a ciclare su tutti i parametri che riceve tramite post ed effettivamente ci deve essere una variabile valorizzata ma non riesco a sapere il nome di questa variabile.
    Lo script dovrebbe in pratica ricevere tutte le informazioni per creare un'immagine.
    Ciao By Peter_Pan...

  2. #2
    Devono essere passati anche delle variabili che si chiamano px seguite da un numero compreso tra 0 e l'altezza. Per esempio se altezza = 10 devi passare anche:
    px0
    px1
    px2
    px3
    px4
    px5
    px6
    px7
    px8
    px9

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309
    grazie nel frattempo ero riuscito a capire quali variabili dovevo intercettare, mi sapresti dare qualche info in più sullo script, devo tradurlo in vb.net ma non conosco per niente php.

    Grazie
    Ciao By Peter_Pan...

  4. #4
    Utente di HTML.it
    Registrato dal
    Jun 2000
    Messaggi
    1,309
    scusate se insisto, mi aiutate a tradurre questo script in vb.net? vi posto quello che ho fatto, anche se mi va in errore:
    Codice PHP:
    Dim strH As Integer
            Dim strW 
    As Integer
            Dim c_row 
    As New ArrayList


            strH 
    Request.Params("height")
            
    strW Request.Params("width")

            
    Dim strRows As Integer
            Dim strCols 
    As Integer
            Dim strValore 
    As String
            Dim hex 
    As String

            Dim r 
    As String
            Dim g 
    As String
            Dim b 
    As String

            Dim strNumero 
    As String

            
    For strRows 0 To strH
                strNumero 
    "px" strRows
                c_row
    .Add(Request.Params(strNumero).Split(","))
                For 
    strCols 0 To strW
                    strValore 
    c_row(strCols)
                    If 
    strValore <> "" Then
                        hex 
    strValore
                        
    While hex.Length 6
                            hex 
    "0" hex
                        End 
    While
                        
    hex(hex.Substring(02))
                        
    hex(hex.Substring(22))
                        
    hex(hex.Substring(42))

                        
    '...
                    End If
                Next

                Response.Write("[b]" & strNumero & ": [/b]" & Request.Params(strNumero) & "
    ")
            Next 
    mi da errore sulla stringa strValore = c_row(strCols) ma non so perchè
    Ciao By Peter_Pan...

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.