[wp-trac] [WordPress Trac] #17242: Themes: Allow flexible sizes for custom header uploads

WordPress Trac wp-trac at lists.automattic.com
Mon Jan 23 20:46:38 UTC 2012


#17242: Themes: Allow flexible sizes for custom header uploads
----------------------------+------------------
 Reporter:  lancewillett    |       Owner:
     Type:  task (blessed)  |      Status:  new
 Priority:  normal          |   Milestone:  3.4
Component:  Themes          |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  dev-feedback    |
----------------------------+------------------

Comment (by aaroncampbell):

 The one real issue that we face is getting the size of the header image
 since it's not fixed.  For the preview on admin I just moved it from being
 a background image to being a regular image tag.  This fixes the unknown
 height issue.  The alternative that I see is to do something like this and
 drop it into the CSS:
 {{{
 $header_image = get_header_image();
 $header_image_post = get_page_by_title( substr( $header_image, strrpos(
 $header_image, '/') + 1 ), null, 'attachment' );
 $header_image_info = image_downsize( $header_image_post->ID, 'full' );
 $header_height = $header_image_info[2];
 }}}

 This seems really heavy just to get the height of an image (too bad
 everyone doesn't have `getimagesize()`).  However, I'm wondering if we're
 going to need something for theme authors to be able to use.  It seems
 that in *most* cases they'll want to add the header image as a background
 and need to know how big to make the container they apply it to.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17242#comment:32>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list