PHPBuilder - Graphing With Flash (SWF) Page 2



RSS Twitter
Articles Php Functions

Graphing With Flash (SWF) - Page 2

by: Bryan Mattern
|
January 10, 2001

#
# Table structure for table 'city'
#

DROP TABLE IF EXISTS city;
CREATE TABLE city (
   city_id int(14) NOT NULL auto_increment,
   city_name varchar(255) NOT NULL,
   city_timestamp timestamp(14),
   PRIMARY KEY (city_id)
);

#
# Dumping data for table 'city'
#

INSERT INTO city VALUES( '1', 'London', '20000917122625');
INSERT INTO city VALUES( '2', 'London', '20000917122626');
INSERT INTO city VALUES( '3', 'London', '20000917122626');
INSERT INTO city VALUES( '4', 'London', '20000917122627');
INSERT INTO city VALUES( '5', 'Paris', '20000917122631');
INSERT INTO city VALUES( '6', 'Paris', '20000917122632');
INSERT INTO city VALUES( '7', 'New York', '20000917122644');
INSERT INTO city VALUES( '8', 'New York', '20000917122645');
INSERT INTO city VALUES( '9', 'New York', '20000917122646');
INSERT INTO city VALUES( '10', 'New York', '20000917122646');
INSERT INTO city VALUES( '11', 'New York', '20000917122647');
INSERT INTO city VALUES( '12', 'Hong Kong', '20000917122654');

Setting up your system for SWF

I use RedHat Linux 6.2, Apache 1.3.12 and PHP 4.0.2, compiled as an Apache module. If you are using PHP on Windows, some things will be different, you will need to get or build a Flash DLL, but the code should work without modification.
PHP offers the ability to create Shockwave Flash files via Paul Haeberli's libswf module. You need to download libswf at http://reality.sgi.com/grafica/flash/. Once you have libswf all you need to do is to configure PHP --with-swf[=DIR] where DIR is a location containing the directories include and lib. The include directory has to contain the swf.h file and the lib directory has to contain the libswf.a file. When the libswf distribution is unpacked, the two files will be in one directory. Consequently you will have to move the files to the proper location. The resulting direcory structure should look the following:
/usr/local/swf/
		/include/
			swf.h
		/lib/
			libswf.a
		/fonts
...
In order to make the SWF functions work properly, you will have to copy the /usr/local/swf/fonts/ directory so it is accessable to your web server (The best way to do this with Apache and mod_php, is to use absolute paths and copy the directory to your Apache installation's DocumentRoot). A small C program is provided in the libswf distibution to convert Type 1 fonts so they can be use with Flash. Because we will be dynamically creating and writing SWF files, the user the web server runs as will have to have write permission wherever you store the files.

« Previous Page
1
|
2
|
3
|
4
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Bryan Mattern

Comment:



Comment:

(Maximum characters: 1200). You have characters left.