Ciao, espongo il quesito:
un applicativo in flash invia allo script in questione uno shot dalla webcam, lo script stampa il jpg e lo invia in una cartella poi gestita da una galleria dinamica. Il tutto senza database.
Il problema che tutto funziona per una sola immagine e non riesco a ciclare o far salvare i diversi file rinominando in successione numerica i jpg.
Allego lo script:
Codice PHP:
<?php     //If GD library is not installed, say sorry     if(!function_exists("imagecreate")) die("Sorry, you need GD library to run this example");     //Capture Post data     $data = explode(",", $_POST['img']);     $width = $_POST['width'];     $height = $_POST['height'];     //Allocate image     $image=(function_exists("imagecreatetruecolor"))?imagecreatetruecolor( $width ,$height ):imagecreate( $width ,$height );     imagefill($image, 0, 0, 0xFFFFFF);     //Copy pixels     $i = 0;     for($x=0; $x<=$width; $x++){         for($y=0; $y<=$height; $y++){             $r = hexdec("0x".substr( $data[$i] , 2 , 2 ));             $g = hexdec("0x".substr( $data[$i] , 4 , 2 ));             $b = hexdec("0x".substr( $data[$i++] , 6 , 2 ));             $color = imagecolorallocate($image, $r, $g, $b);             imagesetpixel ($image,$x,$y,$color);         }     }     //Output image;        ImageJPEG($image, 'immagine_1.jpg'); imagedestroy($image); ?>
Grazie.