Zenphoto Shorttags For Wordpress Plugin [Update 4]
Few know it: Zenphoto is the best web gallery CMS there is. It is minimalistic, fast and stable. It powers this bloggers photostream, and its pictures grace these posts. Zenphoto is so great because the process of cropping, scaling and managing image cache is elegant, excellent, awesome.
This plugin allows you to take that scaling- and cache-management with you to Wordpress.
That means, and read this carefully: you can insert what amounts to a symbolic link to an ultra-high-res Zenphoto image, specify width and the height as an attribute and have Zenphoto do the scale work for you. Even if you replace the source image, you can just purge the Zenphoto cache — all images linked using this plugin will have their scaled versions updated from the new source material. Chew on that one for a while: it’s paradigm changing. That’s what it is.
Not the plugin, mind you, Zenphoto is paradigm changing. This plugin is just an enabler, minimalistic middle-ware. Once installed, in your Wordpress posts and pages, you can write:
[zenphoto src="filename.jpg" width="600" album="album/subalbum"]
… and you’ll get a gorgous image of cows, provided you named the cow image “filename.jpg and placed it in an album called “subalbum which resides in the “album album:
If you configure your default values correctly (you can provide defaults for widths and album), all you have to write is [ zenphoto src="filename.jpg"]
Required parameters:
srcwidth
Optional parameters:
albumheightclassaltlinkcrop(options: tl, tr, bl, br for topleft, topright, bottomleft and bottomright)
Future plans include adding parameters for watermarks, a feature thats already in the Zenphoto core.It is with regret that I’ve had to add an options page. The only thing it does, is take your information as to where you installed Zenphoto (it has to know, it’s the only integration it has). Other than that, I’ve made things real simple; if you forget parameters or forget to configure the path, the plugin will show error messages reminding you what to do.
One last thing: this plugin is different from other Zenphoto / Wordpress plugins, in that it adds a link to the image object, not the cached image. That means you get the benefit of being able to change the size as many times as you want, as you author your posts, by simply changing the parameters. Don’t worry about the cache, by the way, Zenphoto magic makes sure that if the linked image object has already been rendered in your cache, the cache is shown.
[Update]: Version 1.1, added a parameter, link, which when “true auto links to the Zenphoto image in your gallery.
[Update 2]: Version 1.2, New options. You can now specify defaults for width, album and class. Effectively that means you can insert a zenphoto image with only [ zenphoto src="filename.jpg"] provided you have entered proper default values.
[Update 3]: Version 1.3, Added a crop parameter. Right now it’s a rather limited crop. crop="tl" crops the image so that it is unscaled, and top left aligned (hence tl). Also possible, tr, bl, br, for topright, bottomleft and bottom right. Works in conjuction with width and height parameters.
[Update 4]: Now on Wordpress.org.
- How To Fix The Broken Latch On Your Last-Gen Macbook Pro, Which Is Why Your Lid Won't Close
- Zenphoto Shorttags For Wordpress Plugin [Update 4]
- CSS3 Web Fonts Arrives With Firefox 3.1?
- A-List B-Movies: Chronicle Of Greatness

Great job Joel.
The only thing that bothers me is that now we have a bit of cruft with the images pointing to i.php. Maybe it is possible to have a nice permalink setup for it.
Quote
It's Joen :), and thanks.
Google shouldn't care whether your images have "i.php" in the URL, so there's no SEO reason to change things.
If you're referring to the action of copying the URL of an image and sending it to a friend, provided your Zenphoto installation has "fancy URLs", the url will be rewritten as soon as you open it. Try it out: follow this link:
http://noscope.com/photostream/zp-core/i.php?&a=photography/sweden&w=600&i=pic156.jpg
Quote
oops... Sorry about that Joen.
I wasn't worry about SEO. It was just about being able to see how it's hooked up behind the scene (in the html). On another front, since within WP, the info is contained within the short tag, so there won't be a lot of heavy lifting if in the future one want to switch from zenphoto to something else (or, even worse, from WP).
Is there any concerns for DOS attack by flooding i.php to create and cache images with various sizes? Use up CPU and cache?
Your contribution to WP are really great examples for other to share and learn from your code. It makes me want to be able to share the same high-quality plug-ins and themes as yours.
Quote
There has been, but it is my honest impression that the Zenphoto guys have done plenty to prevent this from happening.
Thanks, very much appreciated. Honestly though, I'm really just building the stuff I need myself, both in cases of themes and plugins.
Quote
Works great, thank you
Quote
Hi There, I'm getting the following error:
Warning: getimagesize(/zenphoto/zp-core/i.php?a=2009-05-17&i=IMG_7440.JPG) [function.getimagesize]: failed to open stream: No such file or directory in [edit]/wp-content/plugins/zenphoto-shorttags/zenphoto-shorttags.php on line 65This is the code in my post:
[zenphoto src="IMG_7440.JPG" album="2009-05-17"]Running zenphoto version 1.2.4 & wordpress 2.7.1
Any idea what would be causing it? or how to fix it?
Thank you!
Quote
Yes.
There are only a few reasons why this error will appear, assuming your Zenphoto installatoin has been tested and works.
One is if you're trying to scale a small image up, i.e. the source image is smaller than the size you're trying to insert.
The other option is that you have somehow typed in a wrong filename, a wrong albumname or a combination of the two.
Have you defined any defaults?
Do you have a URL I can look at?
Quote
Here is the post: http://www.the-fosters.org/?p=128
My settings are:
URL to your Zenphoto installation: /zenphoto/
Default image width: 500
Default album: albums
Default CSS class:
Link images: Not Linked
The image shows, but it gives the error at the top.
Thanks for your help!
Quote
So the image does show up? Very odd.
For one thing, try removing the value "albums" from the default album value.
The thing is, the default album value does not refer to the zenphoto "albums" folder. It refers to one of the subfolders of that folder. Let me know if that helps.
Quote
I fixed it.
I found out why the error happened, and I have uploaded a fix to the Wordpres plugins repository. Any time soon you should see the yellow "update" bar in your plugins page.
Quote
Great, thank you! I'll update it and let you know how it works :)
Quote
Just applied the update, no more error. Thank you for your help!
Quote
Hi, Thank you for great plugin !!
One thing though that would be a good to have in your plugin.
That you can choose weather to link to your photo or your album/subalbum that contains your photo because I'm using highslide in my zenophoto albums so the link does not work.
Anyways just a hint for further updates, keep up the good work :D
Regards
Bjork
Quote
Interesting idea, and not a bad one.
How would you suggest I implement this?
Oh and one thing you could do, would be to simply manually create the link (not so elegant, I know, but it works today):
<a href="#" rel="nofollow">[zp src="lolcat.jpg"]</a>I think that should work. Let me know if it doesn't.
Quote
Yes I just used regular link in stead.
But having this options would be so nice and easy.
Just going to management and choose link to album instead of link to photo.
And then it would link to the album that the displayed photo belongs to.
Quote
I think I can build that quite easily, but you realize that if I built it this way, all your photos would link to their albums with no option otherwise? Meaning: either all your photos link to themselves, or all photos link to their album?
Quote
That would be great !!
Yes, I realize that and my opinion that is just fine, because my theme in zenphoto does show all photos in the album so vistors know where he is and can easily click on that picture in there: example: http://bjorkolvers.com/photos/index.php?album=2009%2F20090206BubbiEndurfundir
Thanks a lot !
Bjork
Quote
I'll see what I can do.
Quote