Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,16 @@ public static function get_exif( $post_id, $exif_keys = [] ) {
break;
case 'shutter_speed':
$label = 'Shutter Speed';
$value = '1/' . (int)( 1.0 / (float) $value );
// The value is the exposure time in seconds; skip anything that is not a positive number.
if ( ! is_numeric( $value ) || 0 >= $value ) {
continue 2;
}
// As cameras do, show exposures up to 1/4 second (with a margin for float error) as a rounded fraction and longer ones in seconds.
if ( $value < 0.25001 ) {
$value = '1/' . (int) round( 1 / $value );
} else {
$value = rtrim( rtrim( number_format( (float) $value, 1, '.', '' ), '0' ), '.' ) . 's';
}
break;
}

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Expand Down
Loading