ColdFusion 9.0 Resources |
Access ColdFusion services from a PHP serverTo access ColdFusion services from PHP:
Batch operation on Image:The following
code performs multiple operations on an uploaded image such as batchOperation() to
crop an image and add a border to it.
$input = new batchOperation(); //TODO: fill in the class fields of $input to match your business logic //Crop $element1 = new Element(); $element2 = new Element(); $element3 = new Element(); $element4 = new Element(); $elementArray1 = new ArrayOf_xsd_anyType(); $element1->key = 'x'; $element1->value = '10'; $element2->key = 'y'; $element2->value = '10'; $element3->key = 'width'; $element3->value = '200'; $element4->key = 'height'; $element4->value = '200'; $elementArray1->item[0] = $element1; $elementArray1->item[1] = $element2; $elementArray1->item[2] = $element3; $elementArray1->item[3] = $element4; $ElementcollectionCrop = new Elementcollection(); $ElementcollectionCrop->key = 'Crop'; $ElementcollectionCrop->value = $elementArray1; //AddBorder $element5 = new Element(); $element6 = new Element(); $element7 = new Element(); $elementArray2 = new ArrayOf_xsd_anyType(); $element5->key = 'thickness';$element5->value = '30'; $element6->key = 'color'; $element6->value = 'green'; $element7->key = 'bordertype'; $element7->value = ''; $elementArray2->item[0] = $element5; $elementArray2->item[1] = $element6; $elementArray2->item[2] = $element7; $ElementcollectionAddBorder = new Elementcollection(); $ElementcollectionAddBorder->key = 'AddBorder'; $ElementcollectionAddBorder->value = $elementArray2; $input->serviceusername = "myuser"; $input->servicepassword = "mypassword"; $input->source = "http:/<php server>:<port>/image.jpg"; $input->attributes = array($ElementcollectionCrop,$ElementcollectionAddBorder); // call the operation $response = $proxy->batchOperation($input); |