[wp-hackers] Inclusion of TimThumb -- anyone game?

Chris Jean gaarai at gaarai.com
Thu Mar 5 20:33:35 GMT 2009

I started messing around with code to handle robust image resizing some 
time ago. Since then, it has grown to a nice utility to make working 
with images and files in general fast and simple.

The reason I built something separate from core is because of the 
following reasons:

    * Limitations on growing rather than just shrinking to match dimensions
    * Inability to cache
    * Inability to handle animated images
    * Difficult and overly-complex interface

The features that my code has is as follows:

    * Easy file uploading complete with adding the file to the media library
    * Image resizing with the following options and features:
          o max width/height
          o option to crop image to match resize dimensions
          o easily defined destination
          o set jpeg quality
          o set format (you can convert the image from a jpg to a gif)
          o resizes png images while preserving transparency
          o resizes animated images
    * Convert a file URL to a file path
    * Convert a file path to a file URL
    * Determine MIME type
    * Easily get file attachment data
    * Delete file attachments and their files
    * Determine if a file is an animated gif

My code isn't clean enough to send out at the moment, but I should have 
a link to it on the list later on today. Hopefully what I've developed 
can become the launching point for the plugin or core update that 
everyone will end up building from this discussion.

Chris Jean

Matt Walters wrote:
> Just so I don't come across as devils advocate / combative or whatever 
> let me say, I'm in favor of something like this being implemented.
> One question though, how would the_icon() or the_image() work?  
> the_content() and the_title() works because those are single fields on 
> the post entry form.  I'm not sure adding a "post image" field to the 
> add/edit post screen is a good idea.  Would flagging the image in some 
> way through the media uploader be too complex for the user?
> Any ideas?
> ------------
> Matt Walters
> w: http://mattwalters.net/
> w: http://snipit.me/
> On Mar 5, 2009, at 3:04 PM, Mike Schinkel wrote:
>> "Casey Bisson" <casey.bisson at gmail.com>
>>> 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 strongly agree with this. And even if it gets voted down for core 
>> I'd like to see those of us who see the need collaborate on a plugin 
>> that can be considered the default for such functionality.
>> As I see it we'd need something like this (I present these as a 
>> starting point for discussion):
>> the_image([$args]) where $args could include at least:
>> 'size' => '{width}x{height}' (i.e. 300x250) or a named size, i.e. 
>> 'main', 'tall', 'wide', 'sidebar_thumb' etc. where there would only 
>> be one "reserved"  named size (i.e. 'original'?) which would be the 
>> default when not specified, and the rest would be configurable in 
>> wp_options.
>> 'imagenum' => 0 by default where 0 is the first (and possibly only) 
>> image which means we'd need a image_count() function.
>> A very important component of this is how to store this information 
>> in wp_postmeta and elsewhere.
>> If we do this it can become a building block for a lot of plugins 
>> (including my image cropper plugin that I've not yet released.) That 
>> would IMO be the most important reason to do this.
>> -Mike Schinkel
>> http://mikeschinkel.com/
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list