[wp-hackers] Inclusion of TimThumb -- anyone game?
glenn at glennansley.com
Thu Mar 5 19:40:52 GMT 2009
I've done this for clients in the past like this:
1) Tell them upload an image to their post (but don't actually "send
to editor". Just upload so its associated with the post).
2) Tell them to title it something specific like post_image, icon, or
whatever you want.
Then, in your php loop
* Use this psuedo code: select id from wp_posts where type is image
and parent is [current post] and post_title is [post_splash] limit 1
* Run it through <?php wp_get_attachment_image( $image_id ,
array(75,75), false); ?> and you're golden. (second argument - the
array - is your image dimentions)
BTW, there are a lot of cool functions / filters when you start
digging through wp_get_attachment_image and the functions it depends
on. They're all in wp-includes/media.php.... including image_resize();
Custom WordPress Plugins
On Thu, Mar 5, 2009 at 2:28 PM, Casey Bisson <casey.bisson at gmail.com> wrote:
> What's needed for that is for WP to have a function like the_icon() or
> the_image() that works like the_content() and and the_title(). The question,
> however, is how to set that image when creating posts.
> I implemented something like that in my bSuite plugin; it adds a metabox to
> the post/page editor that allows post authors to define the "icon"
> representing the post. Still, I'd love for WordPress to have a similar
> feature built-in.
> On Mar 5, 2009, at 2:13 PM, Nathan Rice wrote:
>> WordPress already includes an image resizing feature when you upload new
>> images (creates a medium and thumbnail size image). However, I've been a
>> little curious as to how plugin/theme developers can use those features
>> I'd like to formally ask for the hackers' help on this one. If there is a
>> way for a theme/plugin to take advantage of the image upload and resize
>> functions, I'd certainly appreciate a point in the right direction.
>> As far as timthumb, I don't think it would be necessary in core if the
>> thing could be accomplished using pre-existing WordPress functions.
>> My Website
>> My Twitter
>> On Thu, Mar 5, 2009 at 1:36 PM, <zamoose at gmail.com> wrote:
>>> I've noticed a lot of "premium" themes (most recent being the
>>> Smashing Magazeen) are starting to include TimThumb along with their
>>> Easy thumbnail generation, allows for a lot of flexibility on theme
>>> parts, etc. MIT-licensed.
>>> (Must have GD installed, of course, for it to work.)
>>> So, that being said, the question arises: does anyone else see a use case
>>> for including it in WordPress? Recall we had similar discussions in re:
>>> inclusion of the various JS libraries and "include 'em all and let the
>>> plugin/theme devs sort it out!" was the eventual decision. Oh, and the
>>> wonderful wp_enqueue_script() functionality followed...
>>> Grist for the mill, but I come down on the "tentative 'yes'" side of
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers