Prismic.io PHP kit  3.0.0
Public Member Functions | Static Public Member Functions | List of all members
Prismic\Fragment\ImageView Class Reference

Public Member Functions

 __construct ($url, $alt, $copyright, $width, $height, $link)
 
 asHtml ($linkResolver=null, $attributes=array())
 
 ratio ()
 
 getUrl ()
 
 getAlt ()
 
 getCopyright ()
 
 getWidth ()
 
 getHeight ()
 
 getLink ()
 

Static Public Member Functions

static parse ($json)
 

Detailed Description

This class embodies an image view. An image in prismic.io is made of views: a main unnamed one, and optional named ones. Typically, views are different sizes of the same image ("icon", "large", ...), but not necessarily.

Constructor & Destructor Documentation

§ __construct()

Prismic\Fragment\ImageView::__construct (   $url,
  $alt,
  $copyright,
  $width,
  $height,
  $link 
)

Constructs an image view.

Parameters
string$urlthe image view's URL
string$altthe image view's alternative text
string$copyrightthe image view's copyright
int$widththe image view's width
int$heightthe image view's height
LinkInterface$linkthe image view's link to point to

Member Function Documentation

§ asHtml()

Prismic\Fragment\ImageView::asHtml (   $linkResolver = null,
  $attributes = array() 
)

Builds a HTML version of the image view.

Parameters
\Prismic\LinkResolver$linkResolverthe link resolver
array$attributesassociative array of HTML attributes to add to the tag
Returns
string the HTML version of the image view

§ getAlt()

Prismic\Fragment\ImageView::getAlt ( )

Returns the alternative text of the image view.

Returns
string the image view's alternative text

§ getCopyright()

Prismic\Fragment\ImageView::getCopyright ( )

Returns the copyright text of the image view.

Returns
string the image view's copyright text

§ getHeight()

Prismic\Fragment\ImageView::getHeight ( )

Returns the height of the image view.

Returns
int the image view's height

§ getLink()

Prismic\Fragment\ImageView::getLink ( )

Returns the link to point to

Returns
LinkInterface the link to point to

§ getUrl()

Prismic\Fragment\ImageView::getUrl ( )

Returns the URL of the image view.

Returns
string the image view's URL

§ getWidth()

Prismic\Fragment\ImageView::getWidth ( )

Returns the width of the image view.

Returns
int the image view's width

§ parse()

static Prismic\Fragment\ImageView::parse (   $json)
static

Parses a given image view fragment. Not meant to be used except for testing.

Parameters
\stdClass$jsonthe json bit retrieved from the API that represents an image view.
Returns
the manipulable object for that image view.

§ ratio()

Prismic\Fragment\ImageView::ratio ( )

Returns the ratio of the image view.

Returns
int the image view's ratio

The documentation for this class was generated from the following file: