id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses
18951,A function to add default images for themes,F J Kaiser,,"Adding default images to themes is not an easy task. They have to play nicely with different image sizes that are built-in and/or added via {{{add_image_size();}}}. If they don't, then they will simply break the layout or won't change with user changes. Sadly we can't simply use most of the core media/image functions as those functions check if the image is an attachment image and - if not - abort.
So I want to introduce {{{wp_default_img();}}}. It works with an input array of attributes and offers two filters (wp_default_img_attr & wp_default_img). So setting up default images is as easy as using a filter (if the theme developer isn't satisfied with the functions default args) and finally just adding
{{{
// functions.php during init:
add_image_size( 'default_img', 80, 80, true );
// Inside some template
$placeholder = get_site_url( null, 'your_path' ).'/some_img.jpg';
echo wp_default_img( array( 'url' => $placeholder, 'size' => 'default_img' ) );
}}}
The function also cares about cropping images if 4th argument set to {{{true}}} when registering the size using {{{add_image_size();}}}.
Related ticket that pops the whole image size data into [http://core.trac.wordpress.org/browser/branches/3.2/wp-includes/media.php#L580 get_intermediate_image_sizes();], can be found here #18947.",feature request,closed,normal,,Themes,3.2.1,normal,wontfix,has-patch,,