Version:
0.02
Since:
2015-03-24
Example:
../expressiontest.php
Example:
../lifepathtest.php
Example:
$slideshow = new JsSlideshow("bg.jpg", 640, 480);
$slideshow->addAudio( $audioFile);
$slideshow->addSlide( $slideTime );
$slideshow->setFontSize( $fontSize );
$slideshow->setTitle( $title );
$slideshow->addTiles( $fullBirthName );
$slideshowpath = $slideshow->compile();
Package :
Main
Located at JsSlideshow.class.php
public
|
#
__construct( string $backgroundFile, integer $width = null, integer $height = null, string $id = null )
Create an instance
Parameters
- $backgroundFile
string Path to the background image file
- $width
integer (optional) Width of slideshow
- $height
integer (optional) height of slideshow
- $id
string (optional) Unique id of slideshow
|
public
|
#
setTilesImagesDir( string $path )
Sets the tiles images directory
Sets the tiles images directory
Parameters
- $path
string Path to the tiles images directory
|
public
|
#
setSlidesPath( string $path )
Sets the directory where the slides will be saved
Sets the directory where the slides will be saved
Parameters
- $path
string Path to the slides directory
|
public
|
#
setFfmpegBin( string $path )
Sets the path to ffmpeg executable file
Sets the path to ffmpeg executable file
Parameters
- $path
string Path to the slides directory
|
public
|
#
setTab( integer $width )
Sets the Tab width
Parameters
- $width
integer Tab witdth in persent
|
public
stdClass|boolean
|
#
get( integer $index = null )
Get slide object from index or current slide
Get slide object from index or current slide
Parameters
- $index
integer Slide index
Returns
stdClass|boolean Slide object or FALSE
|
public
string
|
#
getID( )
Get slideshow id
Returns
string
|
public
JsSlideshow
|
#
addSlide( float $time = null )
Adds a slide object to the slideshow if no time is specif ied, the slide will
be displayed until the end of the audio file
Adds a slide object to the slideshow if no time is specif ied, the slide will
be displayed until the end of the audio file
Parameters
- $time
float Time in seconds
Returns
|
public
float
|
#
getAudioLen( integer|null $index = null )
Returns the length of the audio file at the specif ied index or length of the
last audio file is added to the slideshow if no index is specif ied
Returns the length of the audio file at the specif ied index or length of the
last audio file is added to the slideshow if no index is specif ied
Parameters
- $index
integer|null (optional) Index of audio file in slideshow
Returns
float Lenght of audio file
|
public
JsSlideshow
|
#
setTitle( string $title, array $style = null )
Adds a title to the slide
Adds a title to the slide
Parameters
- $title
string Title text
- $style
array (optional) CSS styles
Returns
Example
$slideshow->setTitle( "Hello there" ); //Simple
$slideshow->setTitle( 'Hello <red>there</red>',
['margin-top'=>'50px'] ); //Available all power of CSS markup
|
public
JsSlideshow
|
#
addHTML( string $html, array $style = null )
Adds a any HTML code to the slide
Adds a any HTML code to the slide
Parameters
- $html
string HTML code
- $style
array (optional) CSS styles
Returns
Example
$slideshow->addHTML( '<div class="name"> ... </div>' ); //Simple
$slideshow->addHTML( '<div class="name"> ... </div>',
['margin-top'=>'50px'] ); //Available all power of CSS markup
|
public
JsSlideshow
|
#
addCallback( string $fn, array $arguments = array() )
Adds a javascript callback, which will be called when the slide shown
Adds a javascript callback, which will be called when the slide shown
Parameters
- $fn
string Callback function name
- $arguments
array (optional) Arguments, which passed to the function
Returns
Example
//Call JavascriptFunctionName() in frontend when slide is showing
$slideshow->addCallback( 'JavascriptFunctionName' );
//Call alert('Hello Alex!') in frontend when slide is showing
$slideshow->addCallback( 'alert', ['Hello Alex!'] );
|
public
JsSlideshow
|
#
addBullet( string $text, array $style = null )
Adds a Bullet to the slide
Adds a Bullet to the slide
Parameters
- $text
string Title text
- $style
array (optional) CSS styles
Returns
Example
$slideshow->addBullet( "Hello there" ); //Simple
$slideshow->addBullet( 'First slide:\tHello <red>there</red>');
//Bullet with tab
$slideshow->addBullet( 'Hello <red>there</red>',
['margin-top'=>'50px'] ); //Available all power of CSS markup
|
public
JsSlideshow
|
#
addJs( string $code )
Adds a Javascript code to the slideshow
Adds a Javascript code to the slideshow
Parameters
- $code
string Javascript code
Returns
Example
$slideshow->addJs( 'function x2(val){ return val*2; }' );
|
public
JsSlideshow
|
#
addJsFile( string $path )
Adds a Javascript file to the slideshow
Adds a Javascript file to the slideshow
Parameters
- $path
string Path to the Javascript file
Returns
Example
$slideshow->addJsFile( 'path/to/javascript/file.js' );
|
public
JsSlideshow
|
#
addImage( string $path, array $style = null )
Adds an image file to the slideshow
Adds an image file to the slideshow
Parameters
- $path
string Path to the image file
- $style
array (optional) CSS styles
Returns
Example
$slideshow->addImage( 'path/to/the/image.jpg' );
$slideshow->addImage( 'path/to/the/image.jpg', [ 'border' => 'solid 2 px
red' ] );
|
public
JsSlideshow
|
#
addCenteredText( string $text, array $style = null )
Adds centered text on a slide
Adds centered text on a slide
Parameters
- $text
string Text
- $style
array (optional) CSS styles
Returns
Example
$slideshow->addCenteredText( 'Centered text' );
$slideshow->addCenteredText( 'Centered text', [ 'text-shadow' => ' 4px 4px
2px #000' ] ); //With CSS
|
public
JsSlideshow
|
#
addCenteredTextSet( )
Adds a set of centered text in the slideshow. Each text automatically creates
a new slide
Adds a set of centered text in the slideshow. Each text automatically creates
a new slide
Returns
Example
$slideshow->addCenteredTextSet( [5.000, 'Centered text'], ... , [null,
'Centered text', ['white-space' => 'nowrap']] );
|
public
JsSlideshow
|
#
addSlideBullets( )
Adds a set of bullets in the slide. Each bullet placed to the same slide
Adds a set of bullets in the slide. Each bullet placed to the same slide
Returns
Example
$slideshow->addSlideBullets( [2.000, 'First bullet\t text'], ... , [ null,
'Last bullet:\t text', ['color' => '#cc00aa']] );
|
public
JsSlideshow
|
#
clear( )
Sets the clearSlide flag to true, which means that the next slide will be
cleared
Sets the clearSlide flag to true, which means that the next slide will be
cleared
Returns
|
public
JsSlideshow
|
#
setFontSize( ineger $size, string $units = null )
Sets the slide font size
Parameters
- $size
ineger Font size
- $units
string (optional) Font size units, default - px
Returns
|
public
JsSlideshow
|
#
addAudio( string $path )
Adds a audio file to the slideshow
Adds a audio file to the slideshow
Parameters
- $path
string Path to the audio file
Returns
|
public
JsSlideshow
|
#
addBirthTiles( integer $year, integer $m, integer $day, array $style = null )
Generates an Birth Tiles image and add its to slide
Generates an Birth Tiles image and add its to slide
Parameters
- $year
integer Year of birth
- $m
integer Month of birth
- $day
integer Day of birth
- $style
array (optional) CSS styles
Returns
|
public
JsSlideshow
|
#
addTiles( string $text, array $style = null )
Generates an Name Tiles image and add its to slide
Generates an Name Tiles image and add its to slide
Parameters
- $text
string Full name
- $style
array (optional) CSS styles
Returns
|
public
string
|
#
compile( )
Compile added slides to JSON scenario, joins audio, joins script and save
data to slides directory
Compile added slides to JSON scenario, joins audio, joins script and save
data to slides directory
Returns
string Path to the compiled slideshow
Example
$slideshow = new JsSlideshow();
$slideshow->addAudio($path);
$slideshow->addSlide($time);
$slideshow->setTitle($title);
$slideshowpath = $slideshow->compile();
|
public static
float
|
#
mp3FileLength( string $path )
Gets the duration of mp3 file
Gets the duration of mp3 file
Parameters
- $path
string Path to the audio file
Returns
float Duration in seconds
|
public static
string
|
#
parseTags( string $text )
Replace scenario tags with HTML tags
Replace scenario tags with HTML tags
Parameters
- $text
string Text to parse
Returns
string Result text
|
public static
string
|
#
uniqID( )
Generate unique id
Returns
string Unique id
|
public static
string
|
#
toDigit( string $text )
Replaces the letters of their numerological values
Replaces the letters of their numerological values
Parameters
- $text
string Text to parse
Returns
string Result text
|
public static
string
|
#
normalizeText( string $string )
Replaces letters with umlauts or diactrics their ASCII analogues
Replaces letters with umlauts or diactrics their ASCII analogues
Parameters
- $string
string Text to process
Returns
string Result text
|
public static
integer
|
#
ordutf8( string $string, integer $offset = 0 )
Returns the char code of the UTF-8 character As ord() doesn't work with
utf-8, the following function will work well
Returns the char code of the UTF-8 character As ord() doesn't work with
utf-8, the following function will work well
Parameters
- $string
string String with character
- $offset
integer (optional) Reference, as it is not easy to split a utf-8 char-by-char. Useful to
iterate on a string
Returns
integer Char code
|