16. June 2008, 12:24YAPB Plugins / Hooks |
350 |
The way of the master: Install WordPress, convert it to a photoblog via YAPB and finally pimp it up with some plugins.
Already Available Plugins
XP Uploader
Historically the first available third-party extension to YAPB: Developed by Joost, it allows you to upload images directly over the Windows XP File Explorer.
Download the plugin from
the WordPress Plugin repository
YAPB Sidebar Widget
Previously included in the default YAPB installation, the YAPB sidebar widget was outsourced since version 1.9 and has become a plugin of it’s own. Of course, it evolved a little bit and now offers you the following functionality: Either show a list of your prevously posted images or just output some random images. Additionally you now may display a link to your mosiac page below the widget.
Download the plugin from
the WordPress Plugin repository
YAPB XMLRPC Sidebar Widget
Basically the same as the default YAPB Sidebar Widget, this version may display your images remotely on another blog. All you need is a source-blog running YAPB + the YAPB XMLRPC Server Plugin (As seen below) so you can access those images remotely.
Download the plugin from
the WordPress Plugin repository
YAPB XMLRPC Server
Originally provided by Mac, the YAPB XMLRPC Server Plugin allows remote access to your photoblog. You define an API key and voila: Your images are accessible via XML RPC. If you don’t know how to do that: Just have a look at the YAPB XMLRPC Sidebar Widget ;-)
Download the plugin from
the WordPress Plugin repository
Developing your own YAPB Plugin
Ah, finally – The interesting part for us developers ;-) Read this little introduction and have a look at the code of the yapb-sidebar-widget for example, and you should know how to develop YAPB plugins. It’s no rocket science.
Why YAPB Plugins?
First of all: Why splitting YAPB into a main part + plugins? Imho, separating blocks of functionality helps YAPB stay clean, “small” (whatever that means) and helps YAPB keeping focused on its primary target: Extend WordPress to become a Photoblog platform.
Secondly, separate plugins may be developed and evolved separately without any coupling to the main YAPB release cycle. Developers may now create additional features without “asking me for permission” or whatever – just go and do it ;-)
It’s simple
Writing a YAPB-Plugin is basically the same thing as writing a WordPress Plugin – It’s just a matter of view: We develop additional functionality built onto the YAPB foundation:
YAPB basicly offers you the “yapb_register_plugin” action-hook, which gets called right after YAPB initialization. Additionally, your function gets called with the current YAPB Class Instance as parameter: It’s a simple as that:
function my_cool_plugin_initialization($yapb) {
// hook into WordPress,
// add some options to YAPB and
// finally do what you want
}
add_action('yapb_register_plugin', 'my_cool_plugin_initialization');
Have a look at the YAPB Sidebar Widget Plugin for more handy sample code.
The ultimate YAPB Hook Reference
YAPB offers some hooks out of the box. If you’re interested in developing your own YAPB Extension you should have a look at this list:
yapb_register_plugin
Source: Yapb.class.php
Since: 1.9
yapb_register_thumbnail gets fired just after the initialization of YAPB itself (last line in the constructor). That means you can execute code right after YAPB was initialized – And you get the YAPB Instance as Parameter. This hook is an action which means that it primarily acts as an event trigger, instead of a content filter.
yapb_get_thumbnail
Source: YapbTemplateFunctions.php
Parameters: String containg the thumbnail image tag
yapb_get_thumbnail gets fired just before the image tag gets returned from the yapb_get_thumbnail() template function. This hook is a filter which means that information is passed through it, and then used by WordPress.
yapb_get_exif
Source: YapbTemplateFunctions.php
Parameters: Assoziative array containg the exif data
yapb_get_exif gets fired just before the EXIF tags array gets returned from the yapb_get_exif() template function. This hook is a filter which means that information is passed through it, and then used by WordPress.
yapb_alternative_image_formats
Source: YapbTemplateFunctions.php
Parameters: Array containing the alternative image formats
yapb_alternative_image_formats gets fired just before the list of alternative image formats get returned by the according template function. This hook is a filter which means that information is passed through it, and then used by WordPress.
yapb_image_upload
Source: Yapb.class.php
Parameters: YapbImage Instance of the current image
Since: 1.9.18
yapb_image_upload gets fired just after you saved a post containing a YAPB image and that image was persisted to database and disc. This hook is an action which means that it primarily acts as an event trigger, instead of a content filter.
damn_i_need_a_new_hook
If you need a hook in YAPB to develop something new: Leave me a note in the forum so we can discuss it. But hey: I’m the last one blocking new features. As long as it’s not disturbing the way YAPB works, i’m with you.

Comment by Shae
This is a “Sidebar Widget”, but the YAPB-ready themes you list don’t have sidebars. What theme will this work with?
Any suggestion(s) would be appreciated, as I tried this about six months ago and could not get it to work with any sidebar theme I chose. I’m not picky on a theme, as long as it has a sidebar and comments, because I can tweak the colors and styles.
Thanks
Comment by Johannes
Hi Shae -
First of all, you may use YAPB with nearly every theme – Those “ready-to-use-themes” are only very specialiced themes for photography. My homepages theme is a regular type of wordpress theme since i want to write normal articles too. And it uses the YAPB Sidebar Widget. Another possibility would be to use the Widget on another blog to display the images of your photoblog: That may be achieved in conjunction with the YAPB XMLRPC Server Plugin.
But yes: You need a theme with widget-enabled sidebar.
Hope that gave a little overview.
Comment by Shae
I know that “photoblogs” aren’t different from regular blogs. That isn’t the problem.
As I said, the ones I chose did NOT work, and I tried with a half dozen or so. They were Broken. They caused errors.
Can you give a name of a theme that you believe will work, please? Perhaps the one you started with? Or any other?
Comment by Johannes
Try the WordPress Default theme first. YAPB and YAPB Sidebar Widget work with it. If that doesn’t work for you, there is another problem – not a theme problem.
The feedback i got so far shows me that YAPB works with nearly every WordPress theme out there… Personally, i think you could have a technical problem installing YAPB – Not a “YAPB is correctly installed but the theme doesn’t work” kinda problem.
And PLEASE use the forum for support questions.
Greets from Salzburg,
Johannes
Comment by Shae
Meep meep meep meeep mep meep meep meep meep meeep YAPB meep meep, meep meep meep meep. Meeeep meep meep meep meep meep meep meep meeeep mep mep meep.php meep meep meep meep meep meep meeep meeep meeep mep mep meep meep meep meep meeeep.
True, meep meep meep, meeep mep mep mep mep meep, meeep meeep meep meeep meep meeeep meep mep mep meeeep (Meep meeep mep mep mep) meeep meep meep, Meeep meep meep meep meep meeep meeeeeep meep.
Moved answer to the forum.
Comment by Johannes
And PLEASE use the forum for support questions.
Pingback by WP Plugin Archive » YAPB Sidebar Widget
[...] Plugin YAPB Sidebar Widget von Johannes Jarolim ist einer Erweiterung des Yet another Photoblog Plugins des selben Autors. Es [...]
Pingback by WP Plugin Archive » YAPB XMLRPC Server Plugin
[...] YAPB XMLRPC Server Plugin von Johannes Jarolim erlaubt externen Zugriff auf Dein Photoblog. Du definierst einen API Key und [...]
Comment by the.darkman
Hallo,
ich habe YAPB schon länger benutzt und wollte nun auch den Sidbar Widget benutzen. Installation hat super geklappt, aber in den allgemeinen YAPB Optionen ist nirgens etwas bzgl. des Widgets zu finden. Ich nutze die deutsche Version von Wordpress, neusten Version, und auch YAPB ist aktuell. Woran kann das liegen? YAPB selbst funktioniert sehr gut.
Gruß darkman
Comment by George
Hi John,
I downloaded the 1.9.7 version of the plugin, and it appears fine at the plugins list. However, when I go to the Options, the version there mentioned is 1.8.1, and I can’t find any configuration options there for the yapb widget for the latest/random pictures. Is there anything wrong with the installation files?
kind regards,
George
Comment by Jenna
Hi There – When I first installed the plugin, my post would show next to the image but now it shows below the image. Is there a way I can ensure that the post shows up beside the image instead of below??
Thanks!
Comment by Johannes
By default, YAPB images are shown above the content. You may place the images on the left if you change the css in the automatic image insertion tab in the YAPB options. Something like “float:left;” could do the thing, but it could break your layout too – depends on your wordpress theme.
To take control, you could adapt your theme manually with YAPB template tags.
Pingback by Juliany.de/sign » Mein Photoblog
[...] für den Photoblog YAPB XMLRPC Server [...]
Comment by francis
Hi, just want to ask why is the uploaded image in YAPB not showing in the content page?
Need response asap please.
Thanks and happy holidays!
Comment by Johannes
Please provide more info (the url of the post for example) so i may take a look. Do you see the image in the admin area if you edit the post? what’s the size of the image? etc. etc.
and please post that info to the forum:
http://johannes.jarolim.com/yapb-forum
thanks!
Comment by francis
hi, i just posted my problem in the forum last week but no response yet. I badly need answers asap so please…need something to fix it.
thanks in advance.
Comment by Joanna
Can you explain me why photos rendered by YAPB are of worse quality? Compare these: YAPB with Grain – http://photo.pozaschematy.pl/?p=109 and regular website here: http://i1.trekearth.com/photos/5853/ratusz_hdr.jpg. Why this difference in sharpness?
thank you
Joanna
Comment by Johannes
I think your question was answered in the forum – Greets from Salzburg!
Comment by Jon
hi! sweet plugin, absolutely love it. So much in fact, I wrote an export/import plugin for it so that I could migrate Wordpress and all my YAPB images from one site to another.
If you’re interested I can send you the code. Will probably post it on my blog soon too if that’s OK with you!
Comment by Johannes
Hi Jon -
Surely – I’m interested! Let’s meet in the forum?
http://johannes.jarolim.com/yapb-forum
Greets from Salzburg,
Johannes
Comment by Jon
Hi! Didn’t see a way to private message you in the forums so I just made a post here: http://johannes.jarolim.com/ya.....hp?tid=853
Wasn’t sure if that was the right place for it, but I saw some other posts in there about custom plugins, so I stuck it in there.
Let me know what you think!!
Comment by mitcho
Hi Johannes – I’m the developer of Yet Another Related Posts Plugin. One thing I’ve often been asked is how to use YARPP to display thumbnails of related posts. I’m wondering if YAPB has any functions that let you get another post’s thumbnail by post ID. For example, something like: `get_thumbnail($post_ID)` and `thumbnail_exists($post_ID)`. Any advice would be appreciated!
Comment by mitcho
Johannes, actually template tags were all I needed, so I figured it out. :) Thanks a lot. I’ll let you know when the YAPB thumbnail-compatible version of YARPP is out.
Comment by Johannes
Glad you found your answer – Please don’t forget to check for existance of the template function before using it – Then, your plugin will run even if YAPB gets deactivated by the user:
if (function_exists(’yapb_is_photoblog_post’) && yapb_is_photoblog_post()) {
…
}
Greets from Salzburg!
Johannes
Comment by mitcho
Hi Johannes – thanks for your quick reply! I just released the beta of my next version and wrote up how to incorporate Yet Another Related Posts Plugin with YAPB here:
Using Templates with YARPP 3
Thanks for your support!
Comment by Pete
Can you post the template tags that were the solution to your problems? I’m looking for a similar method to get the thumbnail from another YAPB post via post ID and can’t quite get it.
–
Thanks!
Comment by Edwin
Fantastic work! I got a stylish looking photoblog in a matter of an hour, and that’s a feat for a beginner like me! Kudos to you and keep improving YAPB!
Comment by Edwin
Fantastic work! Keep it up!
Comment by Becks
Is there any way to create seperate galleries using the YAPD plugin?
Comment by curro
I can not see the pics in my sidebar. Perhaps is becouse i can’t change permission to the directory of the
> pics??? This is from my ftp program:
>
> SITE CHMOD 777 yapb_cache
> 550 CHMOD 777 yapb_cache: Operation not permitted
>
> Could it be this????
> Thanks
> Curro
Comment by Johannes
The directory YAPB_CACHE should be writeable by the user your Webserver or PHP CGI installation works with so YAPB can cache thumbnails.If you have problems setting the permission via FTP, you could try that action with a filebrowsing app provided by your webhoster or one of the PHP Filebrowsers available all over the net.
Comment by curro
thanks, I did to ‘777′ but now it tell me this:
Thumbnail generation unsuccessful
DEBUG post_id=197
DEBUG Found YAPB image
DEBUG h=80
DEBUG fltr[]=usm|30|3|3
ERROR Couldn’t save /var/www/vhosts/tincan.es/subdomains/noticiasit/httpdocs/imagenes/yapb_cache/informatica3_presenta_nuevas_versiones_de_sus_programas_de_gestion_empresarial2.bw57tr1az1kokc0wc8kskcwcs.89y7syhqq1c8g408w04wk44sc.th.jpeg – Please check cache directory permissions
and i verify that the directory is writable and readable¡¡¡¡
please, help me…
thanks
curro
Comment by Johannes
Hi curro – Please check if the directory above really exists… As far as i know, WordPress usually uploads files and images to a folder called wp-content/uploads: The usual location of the yapb_cache dir is wp-content/uploads/yapb_cache.
And please post such requests to the YAPB-Forum – Thanks!
Comment by curro
thanks Johannes, yes it exist and all my ‘normal’ pics are in there. I change the location for ‘iamgenes’ aT THE BEGGINING of the blog. and I verify just right now again this directory and the yapb_cache are both in ‘777′… so, please… help me…
curro
Comment by curro
ooopsss is a subdomain… couold it be this????
thamnks
curro
Comment by curro
Done¡¡¡ mi ISP had a ’sure protection’ on the subdomain and just this¡¡¡
Thanks very much
Curro
Comment by curro
finished¡¡¡ i have to talk with my ISDP, it has protected my site¡¡¡¡ so now is done and work perfectly.. thanks very much… you has win a cold beer in MAdrid¡¡¡ just give a call when you where here,… and done… thanks