yii\i18n\Formatter::asImage PHP 메소드

asImage() 공개 메소드

Formats the value as an image tag.
public asImage ( mixed $value, array $options = [] ) : string
$value mixed the value to be formatted.
$options array the tag options in terms of name-value pairs. See [[Html::img()]].
리턴 string the formatted result.
    public function asImage($value, $options = [])
    {
        if ($value === null) {
            return $this->nullDisplay;
        }
        return Html::img($value, $options);
    }

Usage Example

예제 #1
0
 public function testAsImage()
 {
     $value = 'http://sample.com/img.jpg';
     $this->assertSame("<img src=\"{$value}\" alt=\"\">", $this->formatter->asImage($value));
     // null display
     $this->assertSame($this->formatter->nullDisplay, $this->formatter->asImage(null));
 }
All Usage Examples Of yii\i18n\Formatter::asImage