| Package | de.popforge.imageprocessing.utils |
| Class | public final class Publish |
| Method | Defined by | ||
|---|---|---|---|
|
sendToSocket(file:ByteArray, host:String, port:int):void
[static]
Establishes a connection to a server and sends the file.
| Publish | ||
|
sendToWeb(file:ByteArray, url:String):void
[static]
Sends a file to a given URL.
| Publish | ||
| sendToSocket | () | method |
public static function sendToSocket(file:ByteArray, host:String, port:int):voidEstablishes a connection to a server and sends the file. This is just a raw connection. Only the file will be send. There is also no handling for any errors at this point.
Parametersfile:ByteArray — Your encoded image.
|
|
host:String — The host you want to connect to.
|
|
port:int — The port on which the server is running (must be greater 1024).
|
| sendToWeb | () | method |
public static function sendToWeb(file:ByteArray, url:String):voidSends a file to a given URL. Therefore the POST method is used and the data is accessible as raw post data.
A simple PHP script to save an image you publish this way could be done like this:
<?php $fp = fopen( 'image.png', 'wb' ); fwrite( $fp, $GLOBALS[ 'HTTP_RAW_POST_DATA' ] ); fclose( $fp ); ?>
file:ByteArray — Your encoded image.
|
|
url:String — The URL that will recieve the file.
|
var video: WebCam = new WebCam( 160, 120 ); var image: Image = new Image( 160, 120, ImageFormat.RGB ); image.loadBitmapData( video.getCurrentFrame(), true ); Publish.sendToWeb( image.toPNG(), 'http://www.foo.com/bar.php' );