LLMS_Question::get_image( string|array $size = 'full', null $unused = null )
Retrieve URL for an image associated with the question if it’s enabled
Parameters Parameters
- $size
-
(string|array) (Optional) Registered image size or a numeric array with width/height.
Default value: 'full'
- $unused
-
(null) (Optional) Unused parameter.
Default value: null
Return Return
(string) Source URL or an Eepty string if no image or not supported.
Source Source
File: includes/models/model.llms.question.php
public function get_image( $size = 'full', $unused = null ) {
$url = '';
if ( $this->has_image() ) {
$img = $this->get( 'image' );
if ( isset( $img['id'] ) && is_numeric( $img['id'] ) ) {
$src = wp_get_attachment_image_src( $img['id'], $size );
if ( $src ) {
$url = $src[0];
} elseif ( isset( $img['src'] ) ) {
$url = $img['src'];
}
}
}
return apply_filters( 'llms_' . $this->get( 'question_type' ) . '_question_get_image', $url, $this );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.16.0 | Introduced. |