Viewing 3 replies - 1 through 3 (of 3 total)
  • jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    I second this, awesome new feature for theme designers.

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    Just changed code starting at line 289 to the below and it seems to work.

    if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) && is_array( $_wp_additional_image_sizes[$s]['crop'] ) )
    			$sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop'];
    		elseif( isset( $_wp_additional_image_sizes[$s]['crop'] ) )
    			$sizes[$s]['crop'] = intval( $_wp_additional_image_sizes[$s]['crop'] );
    		else
    			$sizes[$s]['crop'] = get_option( "{$s}_crop" );

    Basically, if the crop value is an array, it passes the array instead of just 1 or 0.

    Magistar

    (@magistar)

    I tried the code on my local test install (XAMPP) and all my featured images became extremely pixellated. Even 8 bit images would look better.

    function ajax_thumbnail_rebuild_get_sizes() {
    	global $_wp_additional_image_sizes;
    
    	foreach ( get_intermediate_image_sizes() as $s ) {
    		$sizes[$s] = array( 'name' => '', 'width' => '', 'height' => '', 'crop' => FALSE );
    
    		/* Read theme added sizes or fall back to default sizes set in options... */
    
    		$sizes[$s]['name'] = $s;
    
    		if ( isset( $_wp_additional_image_sizes[$s]['width'] ) )
    			$sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] );
    		else
    			$sizes[$s]['width'] = get_option( "{$s}_size_w" );
    
    		if ( isset( $_wp_additional_image_sizes[$s]['height'] ) )
    			$sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] );
    		else
    			$sizes[$s]['height'] = get_option( "{$s}_size_h" );
    
    		if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) && is_array( $_wp_additional_image_sizes[$s]['crop'] ) )
    			$sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop'];
    		elseif( isset( $_wp_additional_image_sizes[$s]['crop'] ) )
    			$sizes[$s]['crop'] = intval( $_wp_additional_image_sizes[$s]['crop'] );
    		else
    			$sizes[$s]['crop'] = get_option( "{$s}_crop" );
    	}
    
    	return $sizes;
    }

    I must admit that I did not check the original code before I made the change. So it could also be a plugin issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Feature Request: Use new $crop parameter’ is closed to new replies.