Making WordPress.org

Changeset 13155

Timestamp:
01/29/2024 10:06:45 PM (6 months ago)
Author:
coffee2code
Message:

Photo Directory, Photo: Round focal length value to at most two decimal places if greater precision is provided.

Props benniledl, roytanck, coffee2code.
Fixes #7427.
Fixes https://github.com/WordPress/wordpress.org/pull/196

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/photo.php

    r12787 r13155  
    942942                case 'focal_length':
    943943                    $label = 'Focal Length';
    944                     $value .= 'mm';
     944                    $value = number_format( (float) $value, 2 );
     945                    if ( 0 >= $value ) {
     946                        continue;
     947                    }
     948                    // Trim trailing zeroes after the decimal place, and potentially the decimal itself, then append 'mm'.
     949                    $value = rtrim( rtrim( $value, '0' ), '.' ) . 'mm';
    945950                    break;
    946951                case 'iso':
Note: See TracChangeset for help on using the changeset viewer.