Welcome to the private homepage of Johannes Jarolim, Salzburg, Austria, Europe. Willkommen auf der privaten Homepage von Johannes Jarolim, Salzburg, Österreich.

Since YAPB 1.5 you may use the following template functions:


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

No Parameters
Returns boolean

Sample usage:

[code language=”php”]<?php if (yapb_is_photoblog_post()): ?>HEHEHE<?php endif ?>[/code]


Function returns an image tag according to the given 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:

[code language=”php”]<?php echo yapb_get_image(‘<div>’, array(‘alt’ => ‘This is an image’), ‘</div>’); ?>[/code]


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:

[code language=”php”]<?php yapb_image(‘<div>’, array(‘alt’ => ‘This is an image’), ‘</div>’); ?>[/code]


Function returns an thumbnail image tag according to the given 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:

[code language=”php”] <?php echo yapb_get_thumbnail(‘<div>’, array(‘alt’ => ‘This is a thumbnail’, ‘rel’ => ‘lightbox’), ‘</div>’, array(‘w=200’, ‘q=90’), ‘thumbnail’); ?> [/code]

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


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:

[code language=”php”]<?php yapb_thumbnail(‘<div>’, array(‘alt’ => ‘This is a thumbnail’), ‘</div>’, array(‘w=200’, ‘q=90’), ‘thumbnail’); ?>[/code]


functions returns a list of the exif tokens if available


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

Returns assoziative array containing all (filtered) EXIF tokens

Sample Usage:

[code language=”php”]<?php $theWonderfulExif = yapb_get_exif() ?>[/code]


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.


  • 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:

[code language=”php”]<h3>EXIF</h3><ul><?php yapb_exif(‘exiftag’, ‘:’, ‘<strong>’, ‘</strong>’, ‘<i>’, ‘</i>’) ?></ul>[/code]


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.


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

Returns string containing some li’s

Sample Usage:

[code language=”php”]<h3>Alternative Image Formats</h3><ul><?php echo yapb_get_alternative_image_formats(array(1600, 1024, 800, 640, 320)) ?></ul>[/code]


Basicly the same as above – Just prints out the result

Parameters: Same as above

Sample Usage:

[code language=”php”] <h3>Alternative Image Formats</h3><ul><?php yapb_alternative_image_formats(array(1600, 1024, 800, 640, 320)) ?></ul>[/code]

Thirty Four Replies

  1. 6. June 2007, 00:24
    Comment by Queso
    How can I set the large image inside the post to be 790px instead of 460?
    this is a great plugin!
    • 19. July 2010, 02:37
      Comment by Dchang
      just in case anyone was wondering (because I struggled with this for some time), you can set the image size by changing the yapb_get_image function in YapbTempalteFunctions.php to this:
      $parameters['width'] = $post->image->width;
      $parameters['height'] = $post->image->height;

      so height/width only get overwritten if not specified
      • 19. July 2010, 10:08
        Comment by Johannes
        Hi Dchang - That's the wrong way. You should use the function yapb_get_thumbnail to get a smaller version of your image. yapb_get_thumbnail automatically renders a smaller version of your image.
  2. 19. August 2007, 01:52
    Comment by Mac [unlesbar]
    Was mich davon abhält, die Funktion 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.
  3. 16. December 2007, 23:31
    Comment by Cyclefitness
    Two questions:

    1. Is this updated for the latest release of WordPress?
    2. Are there instructions for what to do with these functions?
    • 17. December 2007, 18:36
      Comment by Johannes
      1. yes
      2. You can edit your themes template files so the use those functions to display yapb images. More info on the adapt themes manually pages.
  4. 17. December 2007, 20:44
    Comment by Cyclefitness
    Thanks, Johannes. My blog is here: http://www.debbiesilbert.com/photoblog. I want a way to add thumbnails on the sidebar. Is that something I can do with one of these functions? If so, do I need to do anything other than copy the function over to my site and put it on the correct page?
    • 31. January 2008, 14:32
      Comment by Johannes
      Have a look at the sidebar widget provided by YAPB ;-)
  5. 31. January 2008, 13:36
    Comment by Raicho Nikolov
    I have had problems with the sample codes above. You probably have to put it in tags or something like this, because when I copy it it is reformatted and the single quotes are very strange and need to be edited(if they are not edited PHP complains).

    Thank you for the nice plugin! Keep walking :)
    • 31. January 2008, 14:33
      Comment by Johannes
      Thanks - i didn't mention it. I'll have a look how to disable that WordPress feature ;-)
    • 31. January 2008, 14:58
      Comment by Johannes
      Corrected! Thanks again for the tip - If someone has this problem too, just google for "disable wordpress smart quotes" - i used the following plugin: http://www.planetmike.com/journal/plugins/codequotes/
  6. 5. February 2008, 23:08
    Comment by Dario
    Hi! Can you help me with this problem?...
  7. 7. February 2008, 01:06
    Comment by Jorge Otero
    yapb_thumbnail and yapb_get_thumbnail aren't passing the class and title parameters. They seem to be ignored. Is that so?
    • 7. February 2008, 08:59
      Comment by Johannes
      Yup a bug. Released YAPB 1.7.3 some minutes ago. Thanks for the report!

      Happy photoblogging!
  8. 9. February 2008, 14:47
    Comment by Mackan
    I gor this error:

    Warning: Invalid argument supplied for foreach() in /foo/bar/wp-content/plugins/yet-another-photoblog/lib/YapbImage.class.php on line 645

    with this tag:

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

    Using YAPB 1.7.3 with WP 2.3.3
    • 10. February 2008, 18:12
      Comment by Johannes
      Ah - This is a bug in the documentation and will be fixed in some minutes. The second parameter of the function is an array containing additional attributes of the img tag - array('alt' => 'Wonderful image', 'border' => '0') for example.
    • 10. February 2008, 18:23
      Comment by Johannes
      Fixed in the documentation - Thanks for the feedback!
  9. 3. January 2009, 04:47
    Comment by JanT
    Thanks for the template!

    I'm using Grain, also. Warning: dumb question ahead. Would one of the functions above help, or is there a way to add a new page so that it appears at the top of the page?

    Ideally I want to add a separate category of photos, similar to adding a new tab on a website. Possible?

    Thanks very much.
  10. 12. January 2009, 06:13
    Comment by vahid
    yapb_image function doesn't work. it out puts:
    and nothing is being displayed
    But when I activate automatic image insertation for single posts it works fine and output is like this:
  11. 12. January 2009, 06:19
    Comment by vahid
    Hey it was just a localhost issue. sorry
    Great plugin
  12. 22. March 2009, 14:02
    Comment by Paracetamol
    Hello! That's probably a dumb question; but in my template I want to set a link to the file/thumbnail itself, whithout showing the image. Right now, I'm stripping it out of "yapb_get_image" via PHP, but is there a more practicable solution?

    Thanks in advance, also cheers for this great and stable plugin!
  13. 29. April 2009, 03:18
    Comment by KoalaEatingTree
    Hello, I am using YAPB and the phT theme and am stuck on how to have my thumbnails for vertical pictures appear the same as the horizontal picture thumbnails. I want to have all my thumbnails, vert and horizontal, appear the same shape. Thanks!
  14. 6. June 2009, 16:13
    Comment by pvfe
    Hi Johannes!!

    thanks for the plugin, its incredible!
    im having a little issue, and i know im really close to getting it to work...
    i have been able to get thumbnails to appear depending on the category being shown....the problem is when one of those thumbnails are clicked on, they dissapear....this shouldnt happen as they are the navigation of the category!
    im using:
    cat_ID)) {
    while (have_posts()) : the_post();?>
    image): ?>
    <a href="" title=""><img src="image->getThumbnailHref(array('w=100','fltr[]=usm|30|0.5|3')) ?>" alt="" title="" width="100"/>

    any suggestions?
  15. 16. June 2009, 09:37
    Comment by Suresh
    Hi, I'm kinda new to wordpress and blogging. I'm a novice trying to make a mark! Can you please let me know how to upload images without linking them to any particular posts? Can't I just upload a bunch and then have them displayed on my sidebar randomly? Can I also have a slideshow? I installed both, the YAPB and YAPB Sidebar widgets. Using Wordpress 2.8. Please help. Thanks in advance.
  16. 25. June 2009, 14:37
    Comment by Heiko

    ich nutze dieses großartige Plugin schon länger in meinem Blog, möchte es aber nun erweitern. Und zwar möchte ich ein Plugin schreiben, was auf einer Seite alle yapb Bilder in einer google-map anzeigt. Besser noch, alle yapb Bilder deren Artikel zu einer bestimmten Kategorie gehört. Kann ich irgendwie alle yabp Bilder in ner Schleife durchgehen, oder starte ich besser eine neue (the)Loop und parse die nach yapb Bilder durch?
    • 25. June 2009, 14:48
      Comment by Johannes
      Hi Heiko - Normalerweise holst du dir mit normalen WordPress Bordmitteln die Artikel, die du anzeigen willst (Also die der gewünschten Kategorie). Dann gehst du diese ganz normal mit dem Loop durch und zeigst die YAPB Bilder an, sofern vorhanden.

      Tipp: Schau dir auf jeden Fall die Möglichkeit von eigenen Kategorie-Templates in Wordpress an: http://codex.wordpress.org/Category_Templates

      Mach das lieber mit den Bordmitteln - Sonst kannst du lange suchen, bevor du per Hand ein SQL gebaut hast, dass alle Artikel einer Kategorie GEJOINED mit der YAPB-Tabelle zurückliefert: Die Kategorisierung in WP ist zwar superflexibel, benötigt aber etwas Einarbeitungszeit ;-)


  17. 26. June 2009, 14:38
    Comment by Heiko
    Danke für die Hinweise. Habs jetzt mit Bordmitteln gemacht. Ist allerdings gar nicht so einfach *innerhalb* der Loop eine weitere Loop durchlaufen zu lassen. Das musste aber sein, da mein Plugin ein Tag [[map]] zur Verfügung stellt, mit dem ich *innerhalb* von normalen Beiträgen eine Karte anzeigen lassen kann. Deswegen konnte ich das auch nicht imn Template machen, da das denn zu ner riesigen case Wüste ausgeufert wäre, oder die Karte in jedem Beitrag wäre.
    Beispiel: http://trekking-photos.net/?page_id=179 hat im Content einfach nur ein [[map category_name=türkei]] stehen und zeigt die Karte mit allen Fotos die diese Kategorie haben an. Breite und Mittelpunkt werden auch selber ausgerechnet. Wenn Interesse besteht Räume ich das Plugin noch etwas auf und veröffentliche es...

    Greetz, Heiko
  18. 29. June 2009, 20:36
    Comment by mana
    Hi, I’m kinda new to wordpress and blogging. I´ve installed the plug in and its amazing, but i am having a little problem. when i upload a picture for a certain post, image appears everywhere BUT in the home of the blog.... I am using a template called Theme Js O3 Lite designed by Jinwen. Valid CSS 3 & XHTML 1.1.

    could you help me somehow???
  19. 26. October 2010, 19:09
    Comment by Jeremy D'Arcy
    Hello! Great Plugin!

    I need to do something really simple. And your explanation doesn't fully cover this. You say how to include the rel=lightbox, but you don't show how to link the <a href=path to the image...

    I've built the container for the image link, but what is the correct variable that will give me the link to the image, instead of the link to the post?

    I'm currently using:

    e c h o 'obraket a href="' . get_permalink($yapb_image) . '"cbracket';
  20. 26. March 2012, 14:46
    Comment by jakob
    hey there

    someone knows, if there is a way to generate on one page several galleries


    Pic1, pic2



  21. 18. January 2013, 13:54
    Comment by David

    what I am missing is a public API function like yapb_get_thumbnail_src(). Something that takes the $phpThumbConfiguration like yapb_get_thumbnail() but simply returns what you retrieve internally with $post->image->getThumbnailHref($phpThumbConfiguration).

    I know I could hack around that somehow (and I currently do), but it would be nicer to see that as an "official" function.

    Thanks for your work so far, will publish my yapb based theme soon and let you know :)
    • 18. January 2013, 15:33
      Comment by Johannes
      Hi David -

      The functions of the YapbImage Class are public and free to use.
      In every context where you would need that template function you have the image instance available.

      Why do you need that explicit template function?
      Shorter template code?

      Generally, i'm trying to release as few template functions as possible since it's some kind of duplicate code somehow.

      In this case particulary, using the image instance function is just straightforward?

      br from Salzburg,

      - Johannes
  22. 18. January 2013, 16:06
    Comment by David
    Well honestly I figured the class's methods (even if public) not as "official" API functions as I could not find any closer documentation on them. Or did I just miss out something somewhere? Also maybe I am to spoiled from the Drupal world where there seems to be much more concern about such formalities (this is actually my first WP project).

    If you say the methods may be considered "official", everything's fine. In practical, my only concern was that they might disappear or be renamed in a future release, which wouldn't be nice for my theme which relies on them :)

You're welcome to leave a message here

Reload Image