Tema: Subir Imagen
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 16/02/2008, 23:31
Avatar de elfran222
elfran222
 
Fecha de Ingreso: junio-2006
Mensajes: 550
Antigüedad: 17 años, 10 meses
Puntos: 7
Re: Subir Imagen

Continuación upload.php
Código:
                $info = getimagesize($handle->file_dst_pathname);
                echo '  <p>' . $info['mime'] . ' &nbsp;-&nbsp; ' . $info[0] . ' x ' . $info[1] .' &nbsp;-&nbsp; ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB</p></div>';
                echo '  <pre class="code php">' . htmlentities($details) . '</pre>';
                echo '</fieldset>';
            } else {
                echo '<fieldset class="classuploadphp">';
                echo '  <legend>' . $title . '</legend>';
                echo '  Error: ' . $handle->error . '';
                echo '  <pre class="code php">' . htmlentities($details) . '</pre>';
                echo '</fieldset>';
            }
        }    
        if (!file_exists("./test")) mkdir('test');

        // -----------
        TestProcess($handle, 'original file', '');
    
        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_y         = true;
        $handle->image_x               = 50;
        TestProcess($handle, 'width 50, height auto', "\$foo->image_resize          = true;\n\$foo->image_ratio_y         = true;\n\$foo->image_x               = 50;");
    
        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_x         = true;
        $handle->image_y               = 50;
        TestProcess($handle, 'height 50, width auto', "\$foo->image_resize          = true;\n\$foo->image_ratio_x         = true;\n\$foo->image_y               = 50;");
    
        // -----------
        $handle->image_resize          = true;
        $handle->image_y               = 50;
        $handle->image_x               = 50;
        TestProcess($handle, 'height 50, width 50', "\$foo->image_resize          = true;\n\$foo->image_y               = 50;\n\$foo->image_x               = 50;");

        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio           = true;
        $handle->image_y               = 50;
        $handle->image_x               = 50;
        TestProcess($handle, 'height 50, width 50, keeping ratio', "\$foo->image_resize          = true;\n\$foo->image_ratio           = true;\n\$foo->image_y               = 50;\n\$foo->image_x               = 50;");

        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_crop      = true;
        $handle->image_y               = 50;
        $handle->image_x               = 50;
        TestProcess($handle, '50x50, keeping ratio, cropping excedent', "\$foo->image_resize          = true;\n\$foo->image_ratio_crop      = true;\n\$foo->image_y               = 50;\n\$foo->image_x               = 50;");

        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_crop      = 'L';
        $handle->image_y               = 50;
        $handle->image_x               = 50;
        TestProcess($handle, '50x50, keeping ratio, cropping right excedent', "\$foo->image_resize          = true;\n\$foo->image_ratio_crop      = 'L';\n\$foo->image_y               = 50;\n\$foo->image_x               = 50;");

        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_crop      = 'R';
        $handle->image_y               = 50;
        $handle->image_x               = 50;
        TestProcess($handle, '50x50, keeping ratio, cropping left excedent', "\$foo->image_resize          = true;\n\$foo->image_ratio_crop      = 'R';\n\$foo->image_y               = 50;\n\$foo->image_x               = 50;");

        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_fill      = true;
        $handle->image_y               = 50;
        $handle->image_x               = 150;
        TestProcess($handle, '150x50, keeping ratio, filling in', "\$foo->image_resize          = true;\n\$foo->image_ratio_fill      = true;\n\$foo->image_y               = 50;\n\$foo->image_x               = 150;");

        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_fill      = 'L';
        $handle->image_y               = 50;
        $handle->image_x               = 150;
        TestProcess($handle, '150x50, keeping ratio, filling left side', "\$foo->image_resize          = true;\n\$foo->image_ratio_fill      = 'L';\n\$foo->image_y               = 50;\n\$foo->image_x               = 150;");
        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_fill      = 'R';
        $handle->image_y               = 150;
        $handle->image_x               = 100;
        $handle->image_background_color = '#FF00FF';
        TestProcess($handle, '100x150, keeping ratio, filling top and bottom', "\$foo->image_resize          = true;\n\$foo->image_ratio_fill      = 'R';\n\$foo->image_y               = 150;\n\$foo->image_x               = 100;\n\$foo->image_background_color = '#FF00FF';");

        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_crop      = true;
        $handle->image_y               = 50;
        $handle->image_x               = 50;
        $handle->image_crop            = '0 10';
        TestProcess($handle, 'height 50, width 50, cropped, using ratio_crop', "\$foo->image_resize          = true;\n\$foo->image_ratio_crop      = true;\n\$foo->image_crop            = '0 10';\n\$foo->image_y               = 50;\n\$foo->image_x               = 50;");

        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_pixels    = 25000;
        TestProcess($handle, 'calculates x and y, targeting 25000 pixels', "\$foo->image_resize          = true;\n\$foo->image_ratio_pixels    = 25000;");

        // -----------
        $handle->image_resize          = true;
        $handle->image_ratio_pixels    = 10000;
        TestProcess($handle, 'calculates x and y, targeting 10000 pixels', "\$foo->image_resize          = true;\n\$foo->image_ratio_pixels    = 10000;");

        // -----------
        $handle->image_crop            = '20%';
        TestProcess($handle, '20% crop', "\$foo->image_crop            = '20%';");
    
        // -----------
        $handle->image_crop            = '5 20%';
        TestProcess($handle, '5px vertical and 20% horizontal crop', "\$foo->image_crop            = '5 20%';");
        // -----------
        $handle->image_crop            = '-3px -10%';
        $handle->image_background_color = '#FF00FF';
        TestProcess($handle, 'negative crop with a background color', "\$foo->image_crop            = '-3px -10%';\n\$foo->image_background_color = '#FF00FF';");

        // -----------
        $handle->image_crop            = '5 40 10% -20';
        TestProcess($handle, '5px top, 40px right, 10% bot. and -20px left crop', "\$foo->image_crop            = '5 40 10% -20';");
    
        // -----------
        $handle->image_rotate          = '90';
        TestProcess($handle, '90 degrees rotation', "\$foo->image_rotate          = '90';");
    
        // -----------
        $handle->image_rotate          = '180'; 
        TestProcess($handle, '180 degrees rotation', "\$foo->image_rotate          = '180';");
    
        // -----------
        $handle->image_flip            = 'H';
        TestProcess($handle, 'horizontal flip', "\$foo->image_flip            = 'H';");
    
        // -----------
        $handle->image_convert         = 'gif';
        $handle->image_flip            = 'V'; 
        TestProcess($handle, 'vertical flip, into GIF file', "\$foo->image_convert         = 'gif';\n\$foo->image_flip            = 'V';");
    
        // -----------
        $handle->image_convert         = 'bmp'; 
        $handle->image_default_color   = '#00FF00'; 
        $handle->image_rotate          = '180'; 
        TestProcess($handle, '180 degrees rotation, into GIF, green bg', "\$foo->image_convert         = 'gif';\n\$foo->image_default_color   = '#00FF00';\n\$foo->image_rotate          = '180';");

        // -----------
        $handle->image_convert         = 'png';
        $handle->image_flip            = 'H';
        $handle->image_rotate          = '90'; 
        TestProcess($handle, '90 degrees rotation and horizontal flip, into PNG', "\$foo->image_convert         = 'png';\n\$foo->image_flip            = 'H';\n\$foo->image_rotate          = '90';");
     
        // -----------
        $handle->image_bevel           = 20;
        $handle->image_bevel_color1    = '#FFFFFF';
        $handle->image_bevel_color2    = '#000000'; 
        TestProcess($handle, '20px black and white bevel', "\$foo->image_bevel           = 20;\n\$foo->image_bevel_color1    = '#FFFFFF';\n\$foo->image_bevel_color2    = '#000000';");
     
        // -----------
        $handle->image_bevel           = 5;
        $handle->image_bevel_color1    = '#FFFFFF';
        $handle->image_bevel_color2    = '#FFFFFF'; 
        TestProcess($handle, '5px white bevel (smooth border)', "\$foo->image_bevel           = 5;\n\$foo->image_bevel_color1    = '#FFFFFF';\n\$foo->image_bevel_color2    = '#FFFFFF';");

        // -----------
        $handle->image_border          = 5;
        $handle->image_border_color    = '#FF0000';
        TestProcess($handle, '5px red border', "\$foo->image_border          = 5;\n\$foo->image_border_color    = '#FF0000';");

        // -----------
        $handle->image_border          = '5 20 1 25%';
        $handle->image_border_color    = '#0000FF';
        TestProcess($handle, '5px top, 20px right, 1px bot. and 25% left blue border', "\$foo->image_border          = '5 20 1 25%';\n\$foo->image_border_color    = '#0000FF';");