GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Static Public Member Functions | Data Fields
GravityView_Image Class Reference

Generic class for generating image tag. More...

Public Member Functions

 __construct ( $atts=array())
 
 __toString ()
 Handle being treated as a string by returning the HTML. More...
 
 html ()
 Return the HTML tag for the image. More...
 
 set_image_size ( $string=NULL, $width=NULL, $height=NULL)
 Get default widths and heights for image size. More...
 
 validate_image_src ()
 Verify that the src URL matches image patterns. More...
 

Static Public Member Functions

static get_image_extensions ()
 Returns an array of file extensions recognized by GravityView as images. More...
 

Data Fields

 $alt
 
 $class = NULL
 
 $getimagesize = false
 
 $height
 
 $size = NULL
 
 $src
 
 $style = NULL
 
 $title
 
 $validate_src = true
 
 $width
 

Detailed Description

Generic class for generating image tag.

Definition at line 5 of file class-gravityview-image.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $atts = array())

Definition at line 52 of file class-gravityview-image.php.

References set_image_size().

Member Function Documentation

◆ __toString()

__toString ( )

Handle being treated as a string by returning the HTML.

Returns
string HTML of image

Definition at line 47 of file class-gravityview-image.php.

References html().

◆ get_image_extensions()

static get_image_extensions ( )
static

Returns an array of file extensions recognized by GravityView as images.

Since
2.14.3
Returns
array
Runs Filter:
gravityview_image_extensions Extensions that GravityView recognizes as valid images to be shown in an img tag
Parameters
array$image_extsDefault: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp']`

Definition at line 104 of file class-gravityview-image.php.

Referenced by GravityView_Plugin_Hooks_Gravity_Forms_Dropbox\filter_file_extension(), GravityView_Field_FileUpload\get_files_array(), and GravityView_Welcome\getting_started_screen().

◆ html()

html ( )

Return the HTML tag for the image.

Returns
string HTML of the image
Runs Filter:
gravityview_image_html Filter the HTML image output
Parameters
string$htmlthe generated image html
GravityView_Image$thisThe current image object

Definition at line 191 of file class-gravityview-image.php.

References validate_image_src().

Referenced by __toString().

◆ set_image_size()

set_image_size (   $string = NULL,
  $width = NULL,
  $height = NULL 
)

Get default widths and heights for image size.

Returns
void
Runs Filter:
gravityview_image_sizes Modify the image size presets used by GravityView_Image class
Parameters
array$image_sizesArray of image sizes with the key being the size slug, and the value being an array with width and height defined, in pixels

Definition at line 120 of file class-gravityview-image.php.

References $height, and $width.

Referenced by __construct().

◆ validate_image_src()

validate_image_src ( )

Verify that the src URL matches image patterns.

Yes, images can not have extensions, but this is a basic check. To disable this, set validate_src to false when instantiating the object.

Returns
boolean True: matches pattern; False: does not match pattern.

Definition at line 86 of file class-gravityview-image.php.

Referenced by html().

Field Documentation

◆ $alt

$alt

Definition at line 7 of file class-gravityview-image.php.

◆ $class

$class = NULL

Definition at line 17 of file class-gravityview-image.php.

◆ $getimagesize

$getimagesize = false

Definition at line 35 of file class-gravityview-image.php.

◆ $height

$height

Definition at line 11 of file class-gravityview-image.php.

Referenced by set_image_size().

◆ $size

$size = NULL

Definition at line 29 of file class-gravityview-image.php.

◆ $src

$src

Definition at line 8 of file class-gravityview-image.php.

◆ $style

$style = NULL

Definition at line 23 of file class-gravityview-image.php.

◆ $title

$title

Definition at line 9 of file class-gravityview-image.php.

◆ $validate_src

$validate_src = true

Definition at line 41 of file class-gravityview-image.php.

◆ $width

$width

Definition at line 10 of file class-gravityview-image.php.

Referenced by set_image_size().


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