Ticket #18297: custom_header.patch
| File custom_header.patch, 1.9 KB (added by , 14 years ago) |
|---|
-
custom-header.php
416 416 var ximg = jQuery('img#upload').width(); 417 417 var yimg = jQuery('img#upload').height(); 418 418 419 if ( yimg < yinit || ximg < xinit ) { 420 if ( ximg / yimg > ratio ) { 421 yinit = yimg; 422 xinit = yinit * ratio; 423 } else { 424 xinit = ximg; 425 yinit = xinit / ratio; 419 if (yimg > yint) && (ximg > xinit) { 420 if ( yimg < yinit || ximg < xinit ) { 421 if ( ximg / yimg > ratio ) { 422 yinit = yimg; 423 xinit = yinit * ratio; 424 } else { 425 xinit = ximg; 426 yinit = xinit / ratio; 427 } 426 428 } 427 429 } 428 430 … … 484 486 call_user_func( $this->admin_image_div_callback ); 485 487 } else { 486 488 ?> 487 <div id="headimg" style="max-width:<?php echo HEADER_IMAGE_WIDTH; ?>px;height:<?php echo HEADER_IMAGE_HEIGHT; ?>px;background -image:url(<?php esc_url ( header_image() ) ?>);">489 <div id="headimg" style="max-width:<?php echo HEADER_IMAGE_WIDTH; ?>px;height:<?php echo HEADER_IMAGE_HEIGHT; ?>px;background:url(<?php esc_url ( header_image() ) ?>) top left no-repeat;"> 488 490 <?php 489 491 if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) || '' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) || ! $this->header_text() ) 490 492 $style = ' style="display:none;"'; … … 654 656 655 657 list($width, $height, $type, $attr) = getimagesize( $file ); 656 658 657 if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT) {659 if ( ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) || ( ( $width < HEADER_IMAGE_WIDTH && $height < HEADER_IMAGE_HEIGHT ) ) ) { 658 660 // Add the meta-data 659 661 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 660 662 update_post_meta( $id, '_wp_attachment_is_custom_header', get_option('stylesheet' ) );