[wp-hackers] Patch for setting thumbnail size

Owen Winkler ringmaster at midnightcircus.com
Mon Mar 27 18:51:39 GMT 2006


Mark Jaquith wrote:
> There isn't a hook in there for you to use... correct.  Currently, you'd 
> have to replace the entire inline-uploading.php file using the 
> 'uploading_iframe_src' filter hook.

The uploading code is missing some potential hooks.  You should probably 
be able to filter the $override parameter sent to wp_handle_upload() 
from inline-uploading.php.  It's surprising that for how pluggable 
wp_handle_upload() is, that it doesn't handle the thumbnail creation itself.

Of course, the entire thumbnail creation code should be pluggable, since 
one might have a way (via plugin) to create a thumbnail of videos or 
other formats.  Even a standard thumbnail image for things like PDFs 
might be handy.

So when considering what hooks to add to the thumbnail code and how, 
keep more flexibility in mind than "let people change the thumbnail size".

Also, it seems like (I could be reading this wrong) if the thumbnail 
creation in wp_create_thumbnail() experiences an error, then the error 
is returned as text.  The code that accepts the results of 
wp_create_thumbnail() stuffs the result into the attachment record, 
regardless of whether it succeeded.  Oops.

Owen



More information about the wp-hackers mailing list