I would like to develop a plugin to update WP's image functionality. Right now images are displayed inline, which is not very elegant is hard to customize effectively. Right now I use the Get_the_Image plugin with custom fields to avoid inline images, but it doesn't work very well. So I'd like to develop a plugin that relies on the WP image browser but attaches images in custom fields. The inline fuction will not be disabled, so you can still insert images directly into posts, but this plugin will allow greater flexibility and speed.
Here are the ideas I have so far. What would you like to see?
Use custom fields
Static photographer credit
Cutline can be changed per photo, but other cutlines appear in photo listing as example.
Tags for photos
No Javascript (CP's image system ran on Javascript and it sucked tremendously).
Great idea Will. The handling of images was one of the larger frustrations with WordPress that I ran into while redesigning the Pio site this summer; everything just seemed fairly inelegant. I like the outline that you have there and I think that all of those things would be great to implement.
One other thing that could tie in with the static photographer credit would be a way to browse through images by photographer. I don't know how feasible this would be but it would be pretty sweet to see a specific photographers images in a clean and easy way. It could also provide for the ability to greatly expand photo galleries on a site and could turn that photographers archive page into a sort of resume for the rest of the world to see.
Just a thought, I think the other 5 things in that list would be tremendous improvements on the basic WP structure as well.
Andrew – andrew@copress.org – CoPress Hosting Director – http://www.andrewspittle.net
Ability to automagically resize images and, based on the number of images associated with the post, choose from a template to use for laying out the images (i.e. one big one at the top, and multiple inset).
Expose the IPTC metadata (and be able to sort images by that?)
Associate images with authors within WordPress such that you could pull a gallery of the author's images into their author.php page template
Ability to associate multiple images with such that it can generate a gallery at the top of the post (like the Spokesman-Review)
Ah, I see. Since the plugin I'm proposing would use custom fields, it would be very easy to put a thumbnail anywhere, or even edit the excerpt so it would automatically be added.
I wanted to add another thought to this thread. One of the things that has bugged me in the past about using custom fields for images is that the images then no longer show up in the RSS feed (because they aren't embedded in the post, but rather displayed as a part of the website template). It would be great if the leading image for the post, if you were using custom fields, were added to the start of the post content in the RSS feed. I probably would even use this on my personal blog
Oh, I actually do a full RSS feed and the code could be simpler than that. With the right filter, you get the
$content
passed into the function. I'd just append
$content .= $the_image_html + $content;
at the beginning of the content and then return the content. It'd be sweet if this was an option in the plugin; I'd start using this over embedding images in the body text.
You can also create a custom rss template, I believe.
Will, thanks for the helpful function. I'm using a version of what you posted to create an "excerpt" for an article if none exists. However, I'd like the excerpt to end in a period (similar to how CP did it). Without doing a full search of the $words array, is there some simple way of popping off words until you get to a period or changing the explode call?
Thanks, Scott
P.S. I don't mean to hijack this post – this just seemed like an appropriate place to ask the question. My apologies if not.
Update
I actually decided to change this a bit and figured out how to do it. Instead of getting the first x words, I get the first x characters and just search for the last period. This actually fits my use case a bit better, anyway. Here's the code I'm using:
$excerpt_length = 250; $text = substr($text, 0, $excerpt_length); // get the first $excerpt_length characters $text = substr($text, 0, strrpos($text, '.') + 1); // cut off $text at the last period (in the first $excerpt_length characters)
I'd avoid the traditional use of custom fields that most plugins/themes are apt to do, since it's not a very user-friendly method of adding functionality. By this I mean, having users add a field like "show_post_thumbnail" with a specific value, to acheive a specific outcome. The problem with this is that, for the user, it's often hard to remember what the exact custom field name is and what specific values is supposed to be entered to acheive the desired result. This is especially true and becomes really hard when you have multiple plugins that use custom fields or have many different fields available.
One way around it is to automatically add custom fields to posts, but this is a waste.
Instead, I'd recommend making use of either custom meta_boxes or TinyMCE plugins and/or short_codes to make the process easier for users. Take it one step further and hide the custom fields you're using by prepending them with an underscore (e.g. _show_post_thumbnail).
Post edited 11:54 am – September 14, 2009 by John Myrstad
Actually a modification of Stephan Reiters Scissors plugin is implemented in the latest 2.9 trunk version. Its still early days for that enhancement so I`d like to encourage to make an enhancement plugin to work with the new 2.9 features or to participate in the core enhancement: