You Are Here: JARinteractive + Code + PhotoJAR + PhotoJAR: Base

PhotoJAR: Base - Download
Version: 1.0 Beta-5

PhotoJAR: Base provides the groundwork and shared code for other PhotoJAR plugins. Additionally, PhotoJAR: Base provides a number of enhancements to Wordpress gallery functionality:

  • Dynamically resizes thumbnails - changes to image sizes apply retroactively
  • Allows custom image sizes (beyond “thumbnail” and “medium”)
  • Caches resized images
  • Integrates with LightBox, ThickBox, LightView, and many more javascript image viewers
  • Provides an [image] shortcode
  • Can change the default number of columns in a gallery
  • Displays gallery of galleries (thumbnails of child galleries)

Settings

Javascript Viewer - This will set the viewer used when “viewer” is selected in other settings (such as “Link Gallery Images To”).

Link Single Images To - This setting will apply to all images inserted via an [image] shortcode that do not have a link specified.

Link Gallery Images To - This setting will apply to all gallery images that do not have a “linkto” specified.

Image Shortcode (recommended) - If this is enabled, the add media dialog will place an shortcode in the editor in place of HTML. This provides a simple way to adjust settings and allows the image to be resized automatically if settings change.

Gallery Columns - This sets the default number of columns for a gallery.

Gallery Image Size - This sets the default size for images in the gallery. “thumbnail” and “medium” correspond to the settings in the “Miscellaneous” Wordpress settings.

Shortcodes

See “Using the gallery shortcode” for an introduction to shortcodes.

Size - PhotoJAR adds the ability to specify a custom size in both [image] and [gallery] shortcodes in the format “widthxheight” - add “xcrop” if you want the image to be cropped to the exact dimensions. Examples: [image id=23 size="125x150"] or [gallery size="175x175xcrop].

[gallery] attributes:

  • showchildren - set to “true” to display a thumbnail for each child page’s gallery.
    Note: I recommend that you upgrade to Wordpress 2.6 to use this feature. Do to an issue in Wordpress 2.5.1 the orderby attribute must be set for the parent and child galleries when using Wordpress 2.5.1. Most likely you will want to use orderby="menu_order, ID".
  • size - “thumbnail” (default), “medium”, “full” or see description above for advanced usage.
  • linkto - Specifies a URL or size (”full”, “thumbnail”, “viewer”, “default”) for the image to link to. If not present, the “Link Gallery Images To” setting will be used.
  • See “Using the gallery shortcode” for info on the standard attributes for the gallery shortcode.

[image] attributes:

  • id - The id of the image attachment.
  • size - “thumbnail” (default), “medium”, “full” or see description above for advanced usage.
  • title - The image title.
  • align - This corresponds to the setting in the “Add Media” dialog. “none”, “left” (default), “center”, or “right”
  • alt - sets the alt attribute of the <img> tag.
  • linkto - Specifies a URL or size (”full”, “thumbnail”, “viewer”, “default”) for the image to link to. If not present, the “Link Single Images To” setting will be used.

Installation

Requires Wordpress 2.5.1 (2.6 or better recommended) and PHP 5 or greater.

  1. Download PhotoJAR: Base.
  2. Upload the `pj-base` folder to the `/wp-content/plugins/` directory
  3. Activate the plugin through the ‘Plugins’ menu in WordPress
  4. Adjust settings under the ‘Settings -> PhotoJAR’ menu in Wordpress.
  5. Optional: Install a javascript viewer plugin (LightBox, ThickBox, etc.) if you want to make use of that feature. PhotoJAR: Base will handle the markup to enable this on your images.

Tom Johnson has written a nice guide to creating a gallery with PhotoJAR and LightBox.

Note: Due to naming differences with the downloads from the Wordpress,org repository you may need to reset the PhotoJAR cache path and cache URL when upgrading from beta-1. To do this, set PhotoJAR Cache Path and PhotoJAR Cache URL to their default values (displayed immediately below the text boxes for each setting). The PhotoJAR: Base directory name has changed from ‘pj-base’ to ‘photojar-base’. This should not be an issue with any future updates.

22 Responses to “PhotoJAR: Base”

  1. Bernard Doddema Says:

    can you give me a brief rundown on how to install one of these javascript viewer plugins? for example, thickbox.

  2. JARinteractive Says:

    1. Download the ThickBox 3 plugin and place it in your plugin directory.
    2. Activate the plugin.
    3. In Settings->PhotoJAR select ThickBox in the “Link Images To” dropdown list.
    4. Click the “Update Options” button.
    5. Browse to your gallery and click on an image, it should be displayed via ThickBox.

  3. Tom Johnson Says:

    I love this plugin and wrote a post about it here. But I have a question. How can I use the gallery tag and also control the order of the images?

    For example, let’s say I add the gallery tag to a page and I want to pull images 5, 37, and 145 from my Media Gallery. Can I add some kind of code like gallery id=5,37,145 that will pull just those images into the gallery? Or does the gallery always pull all the images uploaded to that post into the post?

    I guess if the gallery tag can’t be configured, I would have to use the image tag, and stack them together such as image id=5, image=37, image=145, right? Thanks for your help.

    Tom

  4. JARinteractive Says:

    Tom, thank you for writing the fantastic how-to!

    To control the order of the images you need to set their “menu order.” I do this using the Reorder Gallery plugin. With Reorder Gallery, all you need to do is drag the images up or down in the gallery tab of the “Add Media” dialog box.

    To include or exclude specific images from the gallery you can try MF Gallery Shortcode. I have not tried this plugin, but it may solve the problem.

  5. RC Says:

    I just tried to install this and got this error:

    Plugin could not be activated because it triggered a fatal error

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/afs2105/public_html/wordpress/wp-content/plugins/pj-base/pj-image-resize.php on line 11

    Any idea what the problem is?

  6. JARinteractive Says:

    RC, what version of PHP are you using? This plugin requires PHP5, check with your web host to see if PHP5 is available.

  7. Tom Johnson Says:

    In the image tag, is there a way to pull in the caption? You have easy tags to the size or the linkto attributes, but what about the caption that appears below the image?

    Here’s what I’m trying to do. I have a grid of images (like an image table of contents) that each link to individual photo galleries. I want captions to appear below each image in the grid of images. Surprisingly, this is hard to do manually and I’d like to use the gallery or image tag, but I run into a problem. In the Add Image dialog box (Gallery tab), I change the Linked To URL to a custom URL, but the image doesn’t link to the customized URL. The Lightbox plugin overrides this or something and won’t take it to the right page. Any ideas on how to do this?

    I wish I could just do something like [image id=335 caption="Zen House"].

    Tom

  8. JARinteractive Says:

    There is currently no way to put a caption on an image. I will try to add that in an upcoming beta. I am already working on a feature that might fit your needs. In the gallery shortcode you will be able to add an attribute that will cause the gallery to display a thumbnail for each child page that contains a gallery.

  9. Kugelblitz Says:

    Hello
    I am using PhotoJAR: Base 1.0 beta-4 with Wordpress 2.6, ThickBox 3 Plugin 1.1 or Lightbox 2.7.5.
    But I have not succeeded to get the Light box to work. It opens the Images in the same window. Like on Tom Johnson page.
    What can I do?

  10. Jackie Says:

    I’ve installed PhotoJar and Lightbox2 and everything went pretty well (I had to disable Contact Form to get the add image to work). Now that it is all done and I followed the walkthru all I see in the Gallery are small grey rectangles. If I click on one of them Lightbox fires and the picture can be seen - you can even navigate and see them all. The problem is that in the post the pictures can’t be seen. Any Ideas?

  11. JARinteractive Says:

    Jackie,

    Check to see if there is a ‘cache’ directory located in the photojar-base plugin directory. Create the ‘cache’ directory if it does not exist.

  12. Jackie Says:

    Somehow that didn’t automagically get created. Creating the folder corrected the problem above.
    Now, above the gallery - once for each picture posted - this error is listed “Error Resizing Image: resize_path_invalid Original Image Path: “/var/www/vhosts/thebellsite.com/httpdocs/blog/wp-content/uploads/2008/07/2008-07-25_0001.jpg” Resize path invalid”
    It’s also with the image in the media library.

  13. Jacob Says:

    Hey guys, getting the same problem as RC here… running WP v2.6, PHP v5.2.5.

  14. JARinteractive Says:

    Please install the phpinfo plugin (http://wordpress.org/extend/plugins/phpinfo/) and verify your PHP version.

  15. jerry Says:

    Hi,

    Can you make it PHP4.3.11 ? PHP4 is still the minimal requirements for Wordpress hosting and that’s what my host has.

    I tried your plugin on my local install and loved it. I was of course disappointed when it failed on my online blog (hosted by Yahoo).

    Thx,
    Jérôme

  16. JARinteractive Says:

    Jerry, I’m sorry you are unable to run PhotoJAR on your Yahoo hosted site. PHP5 offers many improvements that I feel are worth taking advantage of. Official PHP4 support has been discontinued since the end of 2007, so most web hosts should have already moved to PHP5 (or at least offer it). I recommend that you contact Yahoo’s support and inquire about PHP5 support. There are also many other web hosts that provide PHP5 support with affordable plans (I use ICDsoft.com).

  17. Hector Says:

    Hi,

    wonderful plugin, thanks. Actually I saw what you did in:

    http://www.jarinteractive.com/weblog/

    And that’s sort of what I want to do, I explain myself:

    I want a single photo to be showed… but then when I click on it, I’m taken to a gallery with the PhotoJAR/LightBox effect. Pretty much what you have done in:
    http://www.jarinteractive.com/weblog/

    First question: Could you please give me some idea on how you did that?
    Second question: I noticed that when I click on each post, I’m taken to the post itself, where it shows the “grid of pictures”, which is precisely what I do not want… is it possible to avoid the grid?

    Thanks in advance
    Héctor

  18. Sean Gaffney Says:

    Hey! I’m loving this plugin, but have a quick question. Is there any way I can change the behavior of “Link Images To” on a per-gallery basis? I want to be able to use the Lightbox on some galleries, and I’d like other galleries to use the default WP behavior.

    Thanks so much for putting together a great plugin!

  19. JARinteractive Says:

    Hector, I’m glad you like the plugin. Watch my blog for the release of PhotoJAR: Post Thumbnail. I hope to have the initial version ready in the next week or so. PhotoJAR: Post Thumbnailer is now available!

  20. JARinteractive Says:

    Sean, I like your suggestion. I will try to add that feature in the near future. Try Beta-5!

  21. Danny Says:

    I love the plugin, I just have 2 issues. First when I use [gallery showchildren="true"] it will only show thumbnails for 5 galleries. Secondly, and not as important there is a conflict between photojar and the cleaner gallery plugin. When I have cleaner gallery activated and use [gallery showchildren="true"] nothing shows up. Not too concerned about this one, but I’d love to get my first issue resolved.

    Thank You

    -Danny

  22. JARinteractive Says:

    Danny, try Beta-5 and let me know if you still have trouble. There should be no limit on the number of galleries displayed. Cleaner gallery uses a custom display method that conflicts with PhotoJAR, so unfortunately they do not work together at this point.

Leave a Reply