--- sarnold has changed the topic to: upcoming: Gustavo Gonzalez topic: flash & linux Comments: #qc english #redes dutch #taee
|questions on #qc
|hi to everyone
|before nothing, i'd like to thank the oportunity that for the second time MJesus offer us to participate on umeet...
|let's start
|first, i'd like to do a aclaration about the SWF format....
|a lot of people thinks that's propietary and that it's of Macromedia...but that's no true
|SWF is an open format!
|PHP + SWF: How to make a SWF presentation by using Free Software
|because of some strange reasons....the same that some scannsers aren't support in linux, ther's a lot to do for SWF
|What kind of SWF presentations i can make by using PHP?
|R/ In order to see a small sample of the variety of posibilities click here! ;)
|Now you will find a direct and practical guide which will allow you to make simple but cute presentations, by using the Ming library for SWF, PHP code and our little library for presentations: 12Pinguinos.php
|Ming is an open code language library developed as an interface between several programming languages (Java,Perl,C++,Python and PHP) and the multimedia format SWF.
|The oficial site for this library is http://ming.sourceforge.net .In this link you will find several resources related with the library and some tutorials.
|Requirements: To know about PHP programming
|Note: If you don't know anything about this language, start here: http://www.php.net
|In there you will find a guide divided in two sections. The first one is related to the software installation and the other one explains how to take adventage of the different functions contained in the 12Pinguinos.php library.
|we hope that after investigations as we're doing now, the GNU movement and the open source coders in general...
|decide to generate an important applicacion to the development of SWF based presentations in Linux ;)
|while i was waitin my turn to start the conferency
|i decided to create a small example of my work with SWF that i hope you'll like
|http://www.kazak.ws/flash/umeet.swf
|It's been developed 100% in the Linux platform
|now, well....
|¿what kind of presentations in SWF format can i do using PHP?
|by the moment isn't possible to have all the alternatives offered by comercial solutions as Macromedia, but, in terms of presentations is a lot what can be done through the use of free distribution tools
|This lecture pretends to explore the options that can be used using PHP
|Following with demos...i pass to expone aonther set of examples:
|http://www.kazak.ws/12pinguinos/swf/test.html
|All these had been done usind free distribution tools
|(Obviously running in Linux) ;)
|This lecture is divided in two parts: the first is about the installation of the development tools for the presentations...and the second is about the implementation of presentations through an example
|question: <jmones> When you say that swf is a opne forma...what do you mean? it has been publishd (in rtf or pdf)? it's standarized?
|Yes, all the specifications about this format can be found in http://www.openswf.org
|well, continuining with the first part.....the tools and installation one
|The first one is related to the software installation and the other one explains how to take adventage of the different functions contained in the 12Pinguinos.php library.
|In order to elaborate your presentations in an easier way.
|SOFTWARE INSTALLATION (For Unix/Linux Users)
|Note for dummies: Do not install this software in a host that has a web server with PHP support already installed.
|This in order to prevent a re-writing or damage over any installation associated with PHP.
|If you are an expert in this subject, please omit this message.
|Step 1
|- Download the last version of the Ming Library from:
|        http://ming.sourceforge.net
|The file must be named as: ming-0.2a.tgz
|- Download the last version of PHP programming language from:
|        http://www.php.net/downloads.php
|The file must be named as: php-4.2.1.tar.gz
|- If you have no downloaded our library, you must do it from:
|        http://www.kazak.ws/12Pinguinos/12Pinguinos.tar.gz
|- [Optional] Download some text fonts ".fdb" from:
|        http://www.neuralust.com/%7Emingdocs/fonts/swftext.php
|These will be very useful to you.
|Step 2
|Move all the sources of all the mentioned programs in Step 1 to a work directory.
|Ex: /usr/local/src/flash
|Decompress the sources of each program with the following instructions:
|        tar xvfz ming-0.2a.tgz (this will create the ming-02a directory)
|        tar xvfz php-4.2.1.tar.gz (this will create the php-4.2.1 directory)
|        tar xvfz 12Pinguinos.tar.gz (this will create the 12p directory)
|Step 3
|- Ming Installation
|Get into the directory of the Ming sources:
|        cd /usr/local/src/flash/ming-0.2a
|Execute:
|        make
|        make install
|- PHP Installation
|Now you are going to install PHP supported by Ming executing:
|        cd /usr/local/src/flash/php-4.1.2
|        ./configure --with-ming
|        make
|        make install
|If at this point you have not recived an "error message" that means that you are ready to start programming your own slides. Now get into the directory of our library:
|        cd /usr/local/src/flash/12p
|In order to check if everything is correct, execute the following command:
|        php test.php
|If the file "test.swf" is generated form this directory, and, you can see it through your navigator that means that we are ready to start.
|- USING THE 12Pinguinos.php LIBRARY
|First at all you must make the inventary of all the texts you want to put on your presentation. Then you can define the total number of slides you need.
|After this you are going to create a working directory to generate the files of the slides. Ex:
|        mkdir /home/flash-php
|Now make a copy of the 12Pinguinos.php library in your working directory
|        cp 12Pinguinos.php /home/flash-php
|        cd /home/flash-php
|Thereafter create the following subdirectories inside of your working directory
|        mkdir fonts
|        mkdir images
|In the "images" directory put all the images that you want to use in your slides.
|Did you remember the text fonts mentioned in the installation fase? At this moment it is important that you move all fonts downloaded to the "fonts" directory.
|(More fonts means more variety in your design).
|Note: the extension of the fonts is ".fdb" anyother type of extension is not supported. (Do not even try to do it).
|Once you have finished this, edit the 12Pinguinos.php file starting from line #10 and define the names for the flash files on each one of the slides with the array called "slide".
|Do this last one step in secuence from the first slide to the last one.
| It is important to say that the numbre of elements in the array "slide" will be the same number of slides you want to make.
|About the extension of these elements it must be ".swf" in spite of the files to be programmed are ".php" extension.
|Actually these last file are the ones that generate the ".swf" extension files.
|Let's suppose that the array is defined like this:
|        $slide[0] = "slide01.swf";
|        $slide[1] = "slide02.swf";
|        $slide[2] = "slide03.swf";
|        ...
|The next step is to build the files: "slide01.php","slide02.php" an so forth.
|Let's take a look to the first one. In a plain text editor (Ex: pico, vi, emacs and so forth) add the following lines and save the file as: "slide01.php"
|        line 1: <?
|        line 2: @require "12Pinguinos.php";
|        line 3: $movie = doMovie();
|        line 4:
|        line 5: //Working Space
|        line 6:
|        line 7: $movie->save($slide[0]);
|        line 8: ?>
|This will be the first slide of your presentation. Although it doesn't say much :P shows the minimum components number that a slide must have. In fact each ".php" file to build must start with the mentioned lines like a template.
|Line #2 makes the importation of 12Pinguinos.php library.
|Then line #3 makes to start the slide as a flash file. Between lines #4 and #6 the messages and images are added to the slide. This section has been denominated as "Working Space".
|On the other hand in line #7 the file "slide01.swf" is created (at this moment is just a empty slide).
|Once you have finished this, let's continue with the decoration of the file.
|For this you are going to use graphic components and a text. First put the following lines in the "Working Space" section like this:
|        $frame = doBorder($movie);
|        $title = "My First Slide";
|        $posY = 90;
|        $frame = makeTitle($movie,$posY,$title);
|Now the file is going to look like follows:
|        line 1: <?
|        line 2: @require "12Pinguinos.php";
|        line 3: $movie = doMovie();
|        line 4:
|        line 5: $frame = doBorder($movie);
|        line 6: $title = "My First Slide";
|        line 7: $posY = 90;
|        line 8: $fontName = "fonts/ArialBlack.fdb";
|        line 9: $frame = makeTitle($movie,$posY,$title,$fontName);
|        line 10:
|        line 11: $movie->save($slide[0]);
|        line 12: ?>
|At this point the slide has a decorative frame inserted by the line #5 with the function "doBorder". You can find this function in the 12Pinguinos.php file and modified it as you want to create your own style.
|As a matter of fact it is hoped that the library will grow and offer several models.
|In addition to this you can see that in line #9 the slide title is created. The "makeTitle" function center a character chain and put it in the height determinated by the "posY" in the work file. In this case in line #7 we have: "$posY = 90".
|In line #8 the type of font you are going to use is determinated. In this step you should choose one of the fonts that you already added in the "fonts" directory. So you can see that in this the chosen font is "ArialBlack.fdb".
|Thereafter it is time to add a paragraph to the slide. In order to do so, insert the following instructions after line #9.
|        $words[0] = "This is the point I";
|        $words[1] = "This is the point II";
|        $words[2] = "This is the point III";
|        $font[0] = $font[1] = $font[2] = new SWFFont("fonts/Impact.fdb");
|        $size[0] = $size[1] = $size[2] = 35;
|        $color[0] = $color[1] = $color[2] = 0xff;
|        $pos[0] = $pos[1] = $pos[2] = 100;
|        $numLines = 3;
|        $posY = 3;
|        $frame = makeText($movie,$numLines,$posY,$pos,$font,$color,$size,$words);
|As you can observe the "makeText" function locates in an organized way, the chains stored in the "words" array by using the aparence parameters of the array.
|    * "font": defines the type of font for each line
|    * "size": defines the size of the font for each line
|    * "color": defines the red intensity in the RGB space of colors associated to each line. In a future we hope that this function support the three fields: red, green and blue. By now G=0 and B=0 always :P
|* "pos": defines the ubication of the X axis of the text in each line.
|In adition to these there are two simples variables:
|    * "numLines": defines the number of lines to be presented.
|* "posY": is a factor that defines the position in the Y axis, where the first line of the paragraph will start (in this case only 3 lines)
|Remember that you can define different characteristics for each line you are going to write in the slide according to the values you have put on the different arrays already described. (This aspect only depends of your design).
|Next you are going to learn how to add images to the slides. Lets see:
|        $frame = $movie->add(getImage("images/xtingray.jpg"));
|        $frame->scaleTo(0.5,0.5);
|        $frame->moveTo(-110,120);
|Once you get familiarized with the space distribution of your slides, you will surely want to add images in determinated places.
|So, for this matter the "getImage" function form the 12Pinguinos.php library, recives as a parameter the name and the path of the image to be placed (in this case it would be "images/xtingray.jpg").
|If you want, you can scale the image in the X and Y axis withe the function "scaleTo" (this is a Ming type function).
|The scale factors go from 0 to 1.0 in both axis. Moreover you can decide the exact image ubication by using the Ming function "moveTo".
|To this far your slide is lamost ready now let's finish it. In order to do so, you are going to put a botton in the below part of the slide.
|This allow you to link the first slide with the second and in that way you can get the text sequence wanted for the presentation.
|To obtain this you must follow the coming instructions:
|        $x = 300;
|        $y = 400;
|        $nextSlide = "'./$slide[1]'";
|        $image1 = "images/lt1.jpg";
|        $image2 = "images/lt2.jpg";
|        $frame = doButton($movie,$nextSlide,$x,$y,$image1,$image2);
|The "doButton" function of the 12Pinguinos.php library creates a button that link the current slide with another one. The parameters that it recives are:
|    * "movie": current slide
|    * "nextSlide": name and path of the slide to link
|    * "x": the position in the X axis where the button will be placed (settled)
|    * "y": the position in the Y axis where the button will be placed (lower part)
|    * "image1": button image when the mouse is not place on it.
|* "image2": button image when the mouse is on it. (ligthing image)
|In the intermediate slides cases where you can move forward or move back to the coming or the previous slide, in each case, the user can make use of the "doTwoButton" function defined in the library.
|Once you have finished this you are ready to create your first SWF slide. For this you must execute:
|        php diapositiva01.php
|If everything is correct the "slide01.swf" file will be generated. Now that you have finished your collection of slides, you will want to publish it on the Internet.
|To do so in an easy way, you build a web page. It links the first file of your presentation (in this case: slide01.swf).
|If you use JavaScript you will get a more interesting result. If you want an example which show you how to do it, take a look to the "test.html" file that is located in the same directory,
|and if you want modify it with your own requirements you can do it too.
|On the other hand you must take a look to the line #7:
|        window.open('story01.swf','win','width=790,height=505');
|In it you are going to change the function argument (in this is 'story01.swf') by the name of your first slide.
|The parameters "width" and "height" are going to define the window size that is going to appear in the momento you visit the link that appears on the "text.html" page.
|Another thing you must take into account is that you can define the size and resolution of the slides according to your needs.
|By default the 12Pinguinos.php library is designed to work in a 480x500 space in flash proportions as is shown in the following instructions of the Ming library:
|        $movie->setDimension(480,500);
|You are not forced to use this resolution. However; you must remember that the graphics you want to use on your slides must be adecuate to the resolution you use.
|In the subdirectory "images" contained in the library you will find a copy of some of the graphics used for the elaboration of the demo.
|You can use them as a basis to define your own work resolution and make your own buttons.
|Futhermore in the example files you can find the definition of each image used in pixels. Remember with practice you will learn to get the correct proportion in the space to your assigments. Good Luck.
|This has been a "mini" instructions guide. We hope this can be very useful to you.
|The amount of effects and possibilities defined at 12Pinguinos.php file are several, but there is a huge possibility that the file grows hundred of times its size with the contribution of everyone and with time.
|If you are a good php programmer, you can take advantage of all resources available in the library. In addition to this you can also add a new code and share it. It is something we hope happen constantly.
|For a better understanding of all functions presented in 12Pinguinos.php, we recomend you to take a look to the 12 example files available in the library compressed file.
|May the force be with you!
|                                        xtingray

Generated by irclog2html.pl 2.1 by Jeff Waugh - find it at freshmeat.net!