Skip to content

Img

Display an image in your email.

Example

php
use Flowframe\Brief\Components\Html;
use Flowframe\Brief\Components\Body;
use Flowframe\Brief\Components\Img;

Html::make(
    Body::make(
        Img::make('https://example.com/image.png', 'Image')
            ->width(160)
            ->height(120)
    )
);

Methods

make(string $src, string $alt = ''): static

Create a new instance using a src url and alt text.

width(int $width): static

Specify the image width.

height(int $height): static

Specify the image height.

size(int $size): static

Specify the image width and height.

Implements

Styles Interface

Allows a component to receive styles.

php
interface StylesInterface
{
    /**
     * Style the component.
     */
    public function style(Styles $styles): static;

    /**
     * Get the component styles.
     */
    public function getStyles(): Styles;
}

Void Component Interface

Allows a components to render HTML without children. Useful for components such as an img or hr.

php
interface VoidComponentInterface
{
    /**
     * Render the component.
     */
    public function render(): string;
}

Released under the MIT License.