Willkommen auf der privaten Homepage von Johannes Jarolim, Salzburg, Österreich

Welcome to the private homepage of Johannes Jarolim, Salzburg, Austria, Europe.

This is a YAPB post

31. May 2007, 22:05

YAPB Template Functions

232

Since YAPB 1.5 you may use the following template functions:

yapb_is_photoblog_post

Function returns wheter this post is a photoblog post or not.

No Parameters
Returns boolean

Sample usage:

<?php if (yapb_is_photoblog_post()): ?>HEHEHE<?php endif ?>

yapb_get_image

Function returns an image tag according to the given parameters

Parameters:

  1. string $before HTML to be rendered before the image
  2. array $parameters Additional IMG Attributes except src, width and height
  3. string $after HTML to be rendered after the image

Returns string containing the image tag

Sample Usage:

<?php echo yapb_get_image('<div>', array('alt' => 'This is an image'), '</div>'); ?>

yapb_image

Same as yapb_get_image (See above) – It just prints out the result instead of returning it

Parameters: Same as yapb_get_image

Sample Usage:

<?php yapb_image('<div>', array('alt' => 'This is an image'), '</div>'); ?>

yapb_get_thumbnail

Function returns an thumbnail image tag according to the given parameters

Parameters:

  1. string $before HTML to be rendered before the thumbnail
  2. array $parameters Additional IMG Attributes except src, width and height
  3. string $after HTML to be rendered after the thumbnail
  4. array $phpThumbConfiguration The phpThumb configuration
  5. string $class Additional CSS Class of the image

Returns string containing the image tag

Sample Usage:

 <?php echo yapb_get_thumbnail('<div>', array('alt' => 'This is a thumbnail', 'rel' => 'lightbox'), '</div>', array('w=200', 'q=90'), 'thumbnail'); ?> 

As you can see above, this code sample is also an example on how to include the lightbox.js script.

yapb_thumbnail

Same as yapb_get_thumbnail (See above) – It just prints out the result instead of returning it

Parameters: Same as yapb_get_thumbnail

Sample Usage:

<?php yapb_thumbnail('<div>', array('alt' => 'This is a thumbnail'), '</div>', array('w=200', 'q=90'), 'thumbnail'); ?>

yapb_get_exif

functions returns a list of the exif tokens if available

Parameters:

  1. boolean $flagUnfiltered No EXIF-tag filtering if true – Return all EXIF tokens

Returns assoziative array containing all (filtered) EXIF tokens

Sample Usage:

<?php $theWonderfulExif = yapb_get_exif() ?>

yapb_exif

literally the same as the function above – It just prints out the exif tags and gives you some parameters so you can customize the output.

Parameters:

  • string $liClass CSS class of the li tags
  • string $keyValueSeparator HTML between EXIF key and EXIF value
  • string $htmlBeforeKey HTML to be rendered before the EXIF key
  • string $htmlAfterKey HTML to be rendered after the EXIF key
  • string $htmlBeforeValue HTML to be rendered before the EXIF value
  • string $htmlAfterValue HTML to be rendered after the EXIF value
  • boolean $flagUnfiltered No EXIF-tag filtering if true – Return all EXIF tokens

Sample Usage:

<h3>EXIF</h3><ul><?php yapb_exif('exiftag', ':', '<strong>', '</strong>', '<i>', '</i>') ?></ul>

yapb_get_alternative_image_formats

Returns a listitems with links to alternatively provided image sizes. It will only return image sizes lower or equal that the original uploaded file. The array availableSizes contains should contain a list of all sizes to be provided: The number gets mapped to the longer side of the image.

Parameters:

  1. array $availableSizes An array containing all max. sizes to be made available

Returns string containing some li’s

Sample Usage:

<h3>Alternative Image Formats</h3><ul><?php echo yapb_get_alternative_image_formats(array(1600, 1024, 800, 640, 320)) ?></ul>

yapb_alternative_image_formats

Basicly the same as above – Just prints out the result

Parameters: Same as above

Sample Usage:

 <h3>Alternative Image Formats</h3><ul><?php yapb_alternative_image_formats(array(1600, 1024, 800, 640, 320)) ?></ul>

This entry was posted on Thursday 31. May 2007 at 22:05.