ZenphotoCMS 1.6.3

featured_image.php

This plugin provides a functionality to assign an image from your albums to an Zenpage news article, category or page as a "featured image".

You can use this image for example for headers of your single article/page/category pages or within the news article list as a thumbnail. The benefit compared to the embedding an image within the text content statically is that you can control the size of it via your theme's layout dynamically as with gallery items.

To use it you need to modify your theme used if it has no built in support already.

Usage examples:

a) Object model $featuredimage = getFeaturedImage(<object of the Zenpage item>); if($featuredimage) { // if an feature image exists use the object model ?> <?php echo html_encode($featuredimage->getTitle()); ?>

Requirement: Zenpage CMS plugin and a theme supporting it

Tags
since
1.6.3
  • former "half official" plugin included
author

Malte Müller (acrylian) info@maltem.de

copyright

2014 Malte Müller

license:

GPL v3 or later

subpackage

misc

Table of Contents

Classes

featuredImage

Functions

getFeaturedImage()  : mixed
Returns the image object if an featured image is assigned, otherwise false
getSizedFeaturedImage()  : string
Gets a custom sized version of this image based on the parameters. Multimedia items don't use these.
printSizedFeaturedImage()  : string
Print a custom sized version of this image based on the parameters. Multimedia items don't use these.
getFeaturedImageThumb()  : string
Gets the default thumb size of a featured image
printFeaturedImageThumb()  : mixed
Prints the default thumb size of a featured image

Functions

getFeaturedImage()

Returns the image object if an featured image is assigned, otherwise false

getFeaturedImage([obj $obj = NULL ]) : mixed
Parameters
$obj : obj = NULL

Object of the Zenpage article, category you want the featured image to get return mixed

getSizedFeaturedImage()

Gets a custom sized version of this image based on the parameters. Multimedia items don't use these.

getSizedFeaturedImage([obj $obj = NULL ][, int $size = NULL ][, int $width = NULL ][, int $height = NULL ][, int $cropw = NULL ][, int $croph = NULL ][, int $cropx = NULL ][, int $cropy = NULL ][, bool $thumb = false ][, bool $effects = NULL ][, bool $maxspace = false ]) : string
Parameters
$obj : obj = NULL

Object of the Zenpage page, article or category you want the featured image to get. If you set it to NULL on news.php or pages.php it will try to get the image for the current page, news article or category

$size : int = NULL

size

$width : int = NULL

width

$height : int = NULL

height

$cropw : int = NULL

crop width

$croph : int = NULL

crop height

$cropx : int = NULL

crop x axis

$cropy : int = NULL

crop y axis

$thumb : bool = false

set to true to treat as thumbnail. Multimedia items are not used then

$effects : bool = NULL

set to desired image effect (e.g. 'gray' to force gray scale)

$maxspace : bool = false

Set $width and height and this to true (default false) to get a maxspace image. Other size paramaters will be ignored

Tags
since
1.6.3
Return values
string

printSizedFeaturedImage()

Print a custom sized version of this image based on the parameters. Multimedia items don't use these.

printSizedFeaturedImage([obj $obj = NULL ][, string $alt = '' ][, int $size = NULL ][, int $width = NULL ][, int $height = NULL ][, int $cropw = NULL ][, int $croph = NULL ][, int $cropx = NULL ][, int $cropy = NULL ][, string $class = NULL ][, string $id = NULL ][, bool $thumb = false ][, bool $effects = NULL ][, bool $maxspace = false ]) : string
Parameters
$obj : obj = NULL

Object of the Zenpage page, article or category you want the featured image to get. If you set it to NULL on news.php or pages.php it will try to get the image for the current page, news article or category

$alt : string = ''

Alt text of the img element

$size : int = NULL

size

$width : int = NULL

width

$height : int = NULL

height

$cropw : int = NULL

crop width

$croph : int = NULL

crop height

$cropx : int = NULL

crop x axis

$cropy : int = NULL

crop y axis

$class : string = NULL

Class of the img element

$id : string = NULL

Id of the img element

$thumb : bool = false

set to true to treat as thumbnail. Multimedia items are not used then

$effects : bool = NULL

set to desired image effect (e.g. 'gray' to force gray scale)

$maxspace : bool = false

Set $width and height and this to true (default false) to get a maxspace image. Other size paramaters will be ignored

Return values
string

getFeaturedImageThumb()

Gets the default thumb size of a featured image

getFeaturedImageThumb([obj $obj = null ]) : string
Parameters
$obj : obj = null

Object of the Zenpage page, article or category you want the featured image to get. If you set it to NULL on news.php or pages.php it will try to get the image for the current page, news article or category

Tags
since
1.6.3
Return values
string

printFeaturedImageThumb()

Prints the default thumb size of a featured image

printFeaturedImageThumb([string $alt = null ][, string $class = null ][, string $id = NULL ][, string $title = null ][, obj $obj = null ]) : mixed
Parameters
$alt : string = null

Alt text

$class : string = null

optional class attribute

$id : string = NULL

optional id attribute

$title : string = null

optional title attribute

$obj : obj = null

Object of the Zenpage page, article or category you want the featured image to get. If you set it to NULL on news.php or pages.php it will try to get the image for the current page, news article or category

Tags
since
1.6.3

        
On this page

Search results