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
this is a great plugin!
Comment by Dchang
if(!$parameters['width'])
$parameters['width'] = $post->image->width;
if(!$parameters['height'])
$parameters['height'] = $post->image->height;
so height/width only get overwritten if not specified
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
1. Is this updated for the latest release of WordPress?
2. Are there instructions for what to do with these functions?
Comment by Johannes
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.
Comment by Cyclefitness
Comment by Johannes
Comment by Raicho Nikolov
Thank you for the nice plugin! Keep walking :)
Comment by Johannes
Comment by Johannes
Comment by Dario
http://johannes.jarolim.com/yapb-forum/showthread.php?tid=552
Comment by Jorge Otero
Comment by Johannes
Happy photoblogging!
Comment by Mackan
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
Comment by Johannes
array('alt' => 'Wonderful image', 'border' => '0')for example.Comment by Johannes
Comment by JanT
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.
Jan
Comment by vahid
yapb_image function doesn't work. it out puts:
http://localhost/wordpress/wp-content/uploads/2008/12/solace_brushes_by_axeraider.jpg
and nothing is being displayed
But when I activate automatic image insertation for single posts it works fine and output is like this:
http://localhost/wordpress/wp-content/uploads/yapb_cache/solace_brushes_by_axeraider.6nbm1asewhgcocskw40ccg8gk.6ylu316ao0gsowosgg4sog48w.th.jpeg
Comment by vahid
Great plugin
Comment by Paracetamol
Thanks in advance, also cheers for this great and stable plugin!
Comment by KoalaEatingTree
Comment by pvfe
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)) {
query_posts('cat='.$cat->cat_ID.'&showposts=-1');
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?
Comment by Suresh
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?
Comment by Johannes
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 ;-)
greets,
johannes
Comment by Heiko
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
Comment by mana
could you help me somehow???
thanks!
mana
Comment by Jeremy D'Arcy
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';
Comment by jakob
someone knows, if there is a way to generate on one page several galleries
PORTRAIT
(THUMBS)
Pic1, pic2
+++++++++++
PORTRAIT 2
...etc
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 :)
Comment by Johannes
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
Comment by David
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 :)