media::get_item()
From SkyPHP
Return an array of information about an image or other media item. This is used to display an image on a page.
Contents |
Description
array get_item ( mixed $media_item [, int $width [, int $height [, boolean $crop [, array $options ] ] ] ] )
array get_item ( array $options )
Parameters
media_item - the media_item identifier -- either $media_item_id or $media_item_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
- crop_gravity - i.e. center, northeast, south
- upsize - if this is true, the image will be scaled up if necessary to return an image of the correct dimensions
- flv_image - the url of an image to be the cover image of a flash video
Return Values
returns an array with the following elements:
- html - the html to display the item onto the page
- src
- width
- height
Examples
<? // display a 100x100 pixel thumbnail of currently logged in user's default image $media_item_id = aql::value( 'person.default__media_item_id', PERSON_ID ); $img = media::get_item( $media_item_id, 100, 100, true ); echo $img['html']; ?>
See Also
Known Bugs & Issues
- need an option to allow image scale-up (upsize does not appear to be working)
- need ability to crop a specific region
- need to return the media_imgtag records
