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:
- string $before HTML to be rendered before the image
- array $parameters Additional IMG Attributes except src, width and height
- 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:
- string $before HTML to be rendered before the thumbnail
- array $parameters Additional IMG Attributes except src, width and height
- string $after HTML to be rendered after the thumbnail
- array $phpThumbConfiguration The phpThumb configuration
- 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:
- 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:
- 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>
Comment by Queso
Comment by Dchang
Comment by Johannes
Comment by Mac [unlesbar]
yapb_thumbnail()zu nutzen ist der Umstand, dass ich einen Alternativtext, sowie einen Titel angeben können muss. Vielleicht könntest du den entsprechenden 2. Parameter dahingehend abändern, dass bei Übergabe eines Arrays (etwa'alt'=>'...', 'title'=>'...') beides angegeben werden kann. Dann musst du die API nicht wieder umkrempeln. Gleiches gilt für die Übergabe einer ID. Der Ansatz gefällt mir ansonsten.Comment by Cyclefitness
Comment by Johannes
Comment by Cyclefitness
Comment by Johannes
Comment by Raicho Nikolov
Comment by Johannes
Comment by Johannes
Comment by Dario
Comment by Jorge Otero
Comment by Johannes
Comment by Mackan
Comment by Johannes
array('alt' => 'Wonderful image', 'border' => '0')for example.Comment by Johannes
Comment by JanT
Comment by vahid
Comment by vahid
Comment by Paracetamol
Comment by KoalaEatingTree
Comment by pvfe
Comment by Suresh
Comment by Heiko
Comment by Johannes
Comment by Heiko
Comment by mana