Make WordPress Core

Opened 15 years ago

Closed 11 years ago

Last modified 11 years ago

#18297 closed defect (bug) (invalid)

Cropping in step 2 in Custom_Image_Header

Reported by: wpsmith Owned by:
Priority: normal Milestone:
Component: Media Version: 3.2.1
Severity: normal Keywords:
Cc: Focuses:

Description

The cropping should not be based on the ratio but should follow some basic logic.

if ( ( yimg < HEADER_IMAGE_HEIGHT ) && ( ximg < HEADER_IMAGE_WIDTH ) ) no crop
else
do follow current functionality

Attachments (1)

custom_header.patch​ (1.9 KB ) - added by wpsmith 15 years ago.

Download all attachments as: .zip

Change History (14)

#1 @wpsmith
15 years ago

So the JS could be:

if (yimg > yint) && (ximg > xinit) {
			if ( yimg < yinit || ximg < xinit ) {
				if ( ximg / yimg > ratio ) {
					yinit = yimg;
					xinit = yinit * ratio;
				} else {
					xinit = ximg;
					yinit = xinit / ratio;
				}
			}
		}

#2 @wpsmith
15 years ago

So the PHP in function step_2 ():

Replace

if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) {

with

if ( ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) || ( ( $width < HEADER_IMAGE_WIDTH && $height < HEADER_IMAGE_HEIGHT ) ) ) {

#3 @wpsmith
15 years ago

And then in step_1():

Replace

<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() ) ?>);">

with

<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;">

#4 @wpsmith
15 years ago

  • Cc travis@… added
  • Component General → Media
  • Keywords has-patch added

#5 @wpsmith
15 years ago

Custom Image now works well in my sandbox in WP 3.2.1.

#6 @mfields
15 years ago

  • Keywords dev-feedback added; has-patch removed

#7 @wpsmith
15 years ago

  • Keywords has-patch added

#8 @coffee2code
15 years ago

  • Keywords needs-refresh added; has-patch removed
  • Version → 3.2.1

Patch no longer applies cleanly against trunk (currently r20711).

When refreshing the patch, the diff used to produce the patch should be run from the root of the WP install and not a sub-directory.

#10 @ericlewis
12 years ago

  • Keywords reporter-feedback added; dev-feedback removed

@wpsmith, can you explain the problem you're solving here? It's been long enough that I can't comprehend the issue readily, which leans me toward thinking this was fixed sometime in the interim.

#11 @afercia
11 years ago

  • Keywords close added

Last patch is from 4 years ago, no feedback or activity in the last 18 months. @ericlewis I'd suggest to consider closing this ticket :)

#12 @ericlewis
11 years ago

  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → closed

Closing out from lack of direction and activity. Feel free to re-open with more details.

#13 @ericlewis
11 years ago

  • Keywords needs-refresh reporter-feedback close removed
Note: See TracTickets for help on using tickets.