preview()
Description
Returns a preview form (image,audio,video,file) of the specified field (By given metaKey).
Parameters
|
1 2 3 4 5 |
<?php
preview($url,$type='image',$attr=array('thumb'=>true));
?> |
- $url: Field value eg:http://example.com/wp-upload/uploads/audio.mp3 . (required)
- $type: Specific Type (image,audio,video,file) .(required)
- $attr:If your url is image then you can make a thumbnail preview thumb=>true, BY Defaults it is true(not required)
Usage
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?php
$preview = preview('http://example.com/wp-upload/uploads/image.jpg','image',array(thumb=>true)); // By using All parameter
$preview = preview('http://example.com/wp-upload/uploads/file.zip','file'); // using $metakey, $groupindex
if($preview){
echo $preview;
} else{
// do something
}
?> |
Out Put


