Plugin Directory

Changeset 2615765


Ignore:
Timestamp:
10/18/2021 11:17:51 AM (4 years ago)
Author:
aurelienpierre
Message:

Add EXIF metadata display in media view.

Location:
photographers-galleries/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • photographers-galleries/trunk/admin/media-admin.php

    r2506921 r2615765  
    77if ( is_admin() ):
    88
    9 /* 
     9/*
    1010 * Display exif tags in media library
    1111 * Credit : Kevin Chard http://wpsnipp.com/index.php/functions-php/display-exif-metadata-in-media-library-admin-column/
     
    2222function posts_custom_columns_attachment_exif( $column_name, $id ){
    2323    if( $column_name === 'wps_post_attachments_exif' ) {
    24        
     24
    2525        $meta = wp_get_attachment_metadata( $id );
    2626        $time_format = get_option( 'date_format' ) . " – H:i:s";
    27        
     27
    2828        if( !empty( $meta[image_meta][camera] ) ) {
    2929            echo date_i18n( $time_format , $meta[image_meta][created_timestamp] ) ."<hr />";
     
    3333            echo "ISO " . $meta[image_meta][iso] . " – ";
    3434            echo "1/" . round(1 / floatval($meta[image_meta][shutter_speed])) . "<hr />";
    35             echo $meta[image_meta][copyright]. " | ";
     35            echo "© " . $meta[image_meta][copyright] . " | ";
    3636            echo $meta[image_meta][credit];
    3737        }
     
    3939}
    4040
     41function display_exif_in_attachment_modal( $form_fields, $post ){
     42    $meta = wp_get_attachment_metadata( $post->ID );
     43    $time_format = get_option( 'date_format' ) . " – H:i:s";
     44    $exif_string = '';
     45
     46    if( !empty( $meta[image_meta][camera] ) ) {
     47        $exif_string .= date_i18n( $time_format , $meta[image_meta][created_timestamp] ) ."<hr />";
     48        $exif_string .= $meta[image_meta][camera] . " | ";
     49        $exif_string .= $meta[image_meta][focal_length] . " mm<hr />";
     50        $exif_string .= "F/" . $meta[image_meta][aperture]  . " – ";
     51        $exif_string .= "ISO " . $meta[image_meta][iso] . " – ";
     52        $exif_string .= "1/" . round(1 / floatval($meta[image_meta][shutter_speed])) .  "<hr />";
     53        $exif_string .= "© " . $meta[image_meta][copyright] . " | ";
     54        $exif_string .= $meta[image_meta][credit];
     55    }
     56
     57    if( !empty($exif_string) ) {
     58        $form_fields['exif'] = array (
     59            'label' => __('EXIF'),
     60            'input' => 'html',
     61            'html' => $exif_string
     62        );
     63    }
     64    return $form_fields;
     65}
     66add_filter('attachment_fields_to_edit', 'display_exif_in_attachment_modal', 10 , 2);
     67
    4168endif;
  • photographers-galleries/trunk/photographers-galleries.php

    r2605796 r2615765  
    1515 * Plugin URI:  https://wordpress.org/plugins/photographers-galleries/
    1616 * Description: Enhance your galleries with HTML5, metadata, dynamic galleries and add a lightweight carousel to display a sequence of pictures without distractions.
    17  * Version:     1.0.8
     17 * Version:     1.0.9
    1818 * Author:      Aurélien PIERRE
    1919 * Author URI:  https://photo.aurelienpierre.com
     
    4343
    4444function register_pg_styles() {
    45   wp_register_style('pg-css', plugin_dir_url( __FILE__ ).'css/pg-style.min.css', array(), '1.0.8');
    46   wp_register_script('pg-js', plugin_dir_url( __FILE__ ).'js/pg-script.min.js', array(), '1.0.8', true);
     45  wp_register_style('pg-css', plugin_dir_url( __FILE__ ).'css/pg-style.min.css', array(), '1.0.9');
     46  wp_register_script('pg-js', plugin_dir_url( __FILE__ ).'js/pg-script.min.js', array(), '1.0.9', true);
    4747}
    4848
     
    194194  ) );
    195195}
     196
     197// Use a quality setting of 90 for WebP images.
     198// 75 is clearly not enough for photographs.
     199function filter_webp_quality( $quality, $mime_type ) {
     200  if ( 'image/webp' === $mime_type ) {
     201     return 90;
     202  }
     203  return $quality;
     204}
     205add_filter( 'wp_editor_set_quality', 'filter_webp_quality', 10, 2 );
  • photographers-galleries/trunk/readme.txt

    r2605796 r2615765  
    257257== Changelog ==
    258258
     259= 1.0.9 =
     260
     261Add EXIF metadata display in media view.
     262Force WebP thumbnails to quality = 90 because WP default (quality = 75) shows posterization in smooth gradients
     263
    259264= 1.0.8 =
    260265
Note: See TracChangeset for help on using the changeset viewer.