
The Format methods allow you to tap into the on-demand image publishing system of Director. Remember to do all of your format calls before the call for content.
Add a format to the request. Takes a required options parameter describing the format to be returned.
<?php
include('classes/DirectorPHP.php');
$director = new Director('your-api-key', 'your-api-path');
$format = array(
'name' => 'thumb',
'width' => '100',
'height' => '100',
'crop' => 1,
'quality' => 75,
'sharpening' => 1
);
$director->format->add($format);
$recent = $director->content->all(10);
foreach($recent as $content) {
echo '<img src="' . $content->thumb->url . '" />';
}
?>
Similar to add(), but instead specifies the format for the album preview.
<?php
include('classes/DirectorPHP.php');
$director = new Director('your-api-key', 'your-api-path');
$preview = array(
'width' => '50',
'height' => '40',
'crop' => 1,
'quality' => 65,
'sharpening' => 1
);
$director->format->preview($preview);
$album = $director->album->get(1);
echo '<img src="' . $album->preview->url . '" />';
?>
Used before a call is made with the User class. Specifies how to return user profile photos.
<?php
include('classes/DirectorPHP.php');
$director = new Director('your-api-key', 'your-api-path');
$format = array(
'name' => 'thumb',
'width' => '100',
'height' => '100',
'crop' => 1,
'quality' => 75,
'sharpening' => 1
);
$director->format->user($format);
$users = $director->user->all();
foreach($users as $user) {
echo '<img src="' . $user->photos->thumb->url . '" />';
}
?>
Clears the current format settings. Useful if you need to make a separate request with different options.
<?php
include('classes/DirectorPHP.php');
$director = new Director('your-api-key', 'your-api-path');
$format = array(
'name' => 'thumb',
'width' => '100',
'height' => '100',
'crop' => 1,
'quality' => 75,
'sharpening' => 1
);
$director->format->add($format);
$recent = $director->content->all(10);
$director->format->clear();
$format = array(
'name' => 'thumb',
'width' => '50',
'height' => '50',
'crop' => 1,
'quality' => 75,
'sharpening' => 1
);
$director->format->add($format);
$recent_smaller = $director->content->all(10);
?>

