In PHP simply echo your image back to flash:
For images it's best to use the Loader class rather than the URLLoader which is better suited to text or XML.
I think you'll find the loader class far easier for your project.
Hope it helps
No.No.No. I am not loading image from folder.
step1 : I m sending some image information to php (src , width , height)
step2 : PHP code will take that information
step3 : PHP code will crop that particular image (some calcution for quality)
step4 : PHP code will generate some image data that is /* imagejpeg( $imgData ) */ and return back to flash
step5 : Now the problem occur, how can i take that image data in flash or what form
? should i get image data as text format and it needs to be encoded (like jpeg encoder)
? i don't know i already try jpegencoder but i did not get anything
? ? ?
var src:String = "pic.jpg";
var width:String = "250";
var height:String = "250";
var urlReq:URLRequest = new URLRequest(src);
var urlLoader:URLLoader = new URLLoader();
var urlVar:URLVariable = new URLVariable();
urlReq.mehtod = URLRequestMethod.POST;
urlReq.data = urlVar;
urlLoader.load ( urlReq );
trace ( "data access from php done" + ev.target );
// imagejpeg( $imgData )
/* PHP */
$src = $_POST [ 'src' ];
$wd = $_POST [ ' width' ];
$ht = $_POST [ ' height' ];
/* this function will create one black color area for croping refence */
$cropImg = imagecreatetruecolor ( cropImageWd, cropImageHt );
/* this function will reproduce particular image required width and height without reducing the image quality */
imagecopyresampled ( cropImage , sourceImage, destX , destY, sourX, sourY, ect... );
imagejpeg( $imgData ) ;
I am still not sure why your sending an image reference from flash to php and back again.
Why not use the BitMap Class within flash to do your image sizing. It's far easier and more reliable.
Google 'AS3 BitMap Class'
Hope it helps