File path: dist/twist/Core/Models/Resources.model.php
Namespace: Twist\Core\Models
viewImage
— Outputs a Image resource to the HTML using the view tag {img:}. The options to output the image as a URI or as a base64 encoded string are also available.
The first part of the tag is the image path e.g 'packages/Lavish/Resources/images/user.png', the tag for this would be {img:packages/Lavish/Resources/images/user.png}.
You can override Image files that are located in twist or an installed package by placing a copy of the file and path in your apps folder. The override file would be included in the page rather than the original file, the example override file would need ot be created here [app/packages/Lavish/Resources/images/user.png].
Other parameters can be included in the tag, you can use a single or combination of parameters (some examples below):
uri = 1
Output the image URI in plain text, no IMG tag will be output
base64 = 1
Output the image as a base64 encoded string, when used in conjunction with uri the base64 string will be output instead of the URI.
All other parameters passed in will be output as attributes of the IMG tag, for example title='Hello World'
An example of the tag with the title and id parameters set {img:packages/Lavish/Resources/images/user.png,title='Hello World',id='user-77'}
Name | Description |
---|---|
$strReference | n/a |
[$arrParameters = array()] | n/a |
void — No return information has been documented for this function.
<?php
//Set the variables for the example
$strReference = 'foo';
$arrParameters = array();
//Call the function viewImage with the example vars
$resResources = new \Twist\Core\Models\Resources();
$resResources -> viewImage($strReference, $arrParameters);