« Back to slideshowpro.net
SlideShowPro Help Wiki
Recent changes / Search

SlideShowPro for Flash

SlideShowPro for Lightroom

SlideShowPro Director

SlideShowPro Director Hosting

Extras

Screencasts

SlideShowPro Director
Utilities methods
Page last modified by bdaily on April 23, 2008, at 09:26 PM

The Utilities methods are useful functions for working with Director data.

is_video(filename)

Check if a piece of content is a video.

<?php

   include('classes/DirectorPHP.php');
   $director = new Director('your-api-key', 'your-api-path');

   $recent = $director->content->all(10);

   foreach($recent as $content) {
      $out = $content->src . ' is a ';
      if ($director->utils->is_video($content->src)) {
         $out .= 'video';
      } else {
         $out .= 'image';
      }
      echo $out . '<br />';
   }

?>

is_image(filename)

The same as is_video, except returns true if the content is an image.

truncate(string, limit = 40, tail = '...')

Truncate a long string to a given character limit.

<?php

   include('classes/DirectorPHP.php');
   $director = new Director('your-api-key', 'your-api-path');

   $recent = $director->content->all(10);

   foreach($recent as $content) {
      echo $content->src . '<br />';
      echo $director->utils->truncate($content->caption) . '<br /><br />';
   }

?>

convert_line_breaks(string)

Converts the line breaks in a string to paragraph tags and HTML breaks.

<?php

   include('classes/DirectorPHP.php');
   $director = new Director('your-api-key', 'your-api-path');

   $recent = $director->content->all(10);

   foreach($recent as $content) {
      echo '<h1>' . $content->src . '</h1>';
      echo $director->utils->convert_line_breaks($content->caption);
   }

?>


© 2008 Dominey Design Inc. All Rights Reserved.
About | Contact | Privacy policy | License agreements