media::get_random_item()

From SkyPHP

Jump to: navigation, search

Return an array of information about a random item from a vfolder.

Contents

Description

array get_item ( mixed $media_vfolder [, int $width [, int $height [, boolean $crop [, array $options ] ] ] ] )
array get_item ( array $options )

Parameters

media_vfolder - the media_vfolder identifier -- $vfolder_path OR $media_vfolder_id OR $media_vfolder_ide (see encrypt)

width - the width of the image to be returned

height - the height of the image to be returned

crop - if true, the image will be scaled and cropped to fit the exact dimensions; if false, the image will be scaled to be no larger than the specified dimensions and could likely result in a different aspect ratio

options - array of additional options

Return Values

returns an array with the following elements:

Examples

<?

// display a 100x100 pixel thumbnail of a random image of the currently logged in user
 
$vfolder_path = '/person/' . PERSON_ID . '/profile-pics';
$img = media::get_random_item( $vfolder_path, 100, 100, true );
echo $img['html'];

?>

See Also

Known Bugs & Issues

n/a

Personal tools