1. Introduction
1.1 What is Flash remoting?
Directly from Macromedia Remoting site: "Macromedia Flash Remoting MX provides the connection between Macromedia Flash and your web application server, making it fast and easy to create Rich Internet Applications. With its powerful yet simple programming model, you can easily integrate rich Macromedia Flash content with applications built using Macromedia ColdFusion MX, Microsoft .NET, Java, and SOAP-based web services."
1.2 What is AMF-PHP ?
Because Macromedia didn't provide support for PHP on Flash remoting an opensource project started to allow php coders to gain access to all the benefits of flash remoting under their preferrend server side language.
"Ubiquity, stability, and platform neutrality make PHP the perfect server side scripting language for building server side applications, handling business logic, and connecting to web services. Ubiquity, stability, and platform neutrality make Macromedia Flash MX the perfect tool for deploying rich internet front ends. Flash remoting for PHP offers a seamless connection between the flash client and php server applications. "
Visit the project home page for more details
1.3 What do you Need ot work with this tutorial.
a) Install AMFPHP
First of all visit the CVS repository of AMFPHP and download all the files under /flashservices directory. Under your web server root create a folder named flashservices and copy there all the files downloaded.
Your root directory will look someting like this:
b) Install GD library
After this you need to install under your php installation the GD library (1.6 used in this tutorial) in order to make the run-time thumb images
2. Start Up
2.1 What we are going to create
Before starting let's take a look at what we are going to create in this tutorial:
ImageBrowser link
2.2 Set up the directories
Now we have to create the directory to put you flash and php files. Create a new direcotry under your web server root dir named "imagebrowser".
Under the dir just created create a new dir named "images"
Follow the example from this image:
Under the images directory now you can create how many directory you want and place there all the jpeg images you need to use for this image galley. The directory name you use will be displayed as album name under the final application
2.3 Create the gateway.php for the remoting connection
Let's start writing the gateway file which will call flash services and will be the flash responder in the server.
In the folder /flashservices create a file name "gateway.php" with this code:
<?php
include("./app/Gateway.php");
$gateway = new Gateway();
$gateway->setBaseClassPath(realpath("services/") . "/");
$gateway->service();
?>
Next we include the Gateway.php:
include("./app/Gateway.php");
Then we create the Gateway class
$gateway = new Gateway();
Tell where the class service is placed (we will write it later), and at leat start serve service
$gateway->setBaseClassPath(realpath("services/") . "/");
$gateway->service();
