Here are a list of changes that I’ve made to the “Yet Another PhotoBlog” (YAPB) plug-in for WordPress.
Prevent duplicate instances of an image from automatically being inserted into a “single” page. This bug may creep up depending on a combination of installed plugins.
File: Yapb.class.php
Line: 836
Replace this:
1 | global $post; |
With this:
1 2 3 4 5 6 7 | global $post, $yapb_nodupe; if (!isset($yapb_nodupe)) { $yapb_nodupe = true; } else if (is_single()) { return ''; } |
Switch to a proportional Width and Height, where the “max size” applies to which ever dimension is the largest (instead of applying ONLY to the image width, allowing images to become super tall)
File: Yapb.class.php
Line: 863
Replace this:
1 | $options = array('w=' . get_option('yapb_display_images_' . $area[0] . '_thumbnail')); |
With this:
1 2 3 4 | $options = array( 'w=' . get_option('yapb_display_images_' . $area[0] . '_thumbnail'), 'h=' . get_option('yapb_display_images_' . $area[0] . '_thumbnail') ); |
AND
File: YapbImage.class.php
Line: 563
Replace this:
1 | $phpThumb->$key = $value; |
With this:
1 | $phpThumb->setParameter($key, $value); |
Change the image link on “single” pages to link to the full size version of the image, instead of linking back to the same page.
File: Yapb.class.php
Line: 876
Replace this:
1 | $hrefBeforeImage = '<a class="yapb-image-link" href="' . get_permalink() . '"' . $target . '>'; |
With this:
1 2 3 4 5 | if ($area[0] === 'single') { $hrefBeforeImage = '<a class="yapb-image-link" href="' . $image->uri . '"' . $target . '>'; } else { $hrefBeforeImage = '<a class="yapb-image-link" href="' . get_permalink() . '"' . $target . '>'; } |
Fix the WARNING messages when the unlink() function is called while attempting to either update or remove images or thumbnails.
File: YapbImage.class.php
Line: 645
Replace this:
1 2 3 4 5 6 7 | for ($i=0, $len=count($allThumbnails); $i<$len; $i++) { unlink($allThumbnails[$i]); } // now we delete the original image unlink($this->systemFilePath()); |
With this:
1 2 3 4 5 6 7 | for ($i=0, $len=count($allThumbnails); $i<$len; $i++) { @unlink($allThumbnails[$i]); } // now we delete the original image @unlink($this->systemFilePath()); |


























