• Your plugin is great as is.

    But one feature I think t needs is that in the absence of a date in the exif data it should also look at the file name (many images have the date coded into the file name, e.g. 20191120_183022.jpg)

    Could you try extracting that date that way as well as a fallback?

    Alternatively if you do not want to add that feature could you please add a filter (maybe around line 85 of the main plugin class) so that I could add that logic myself without potentialy updating the image twice?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Katsushi Kawamori

    (@katsushi-kawamori)

    Thanks feedback.
    That’s an interesting idea.
    I’ll try it.
    Please wait a while.

    Plugin Author Katsushi Kawamori

    (@katsushi-kawamori)

    Ver 1.04 Added filter.

    /**  ==================================================
     * Sample snippet for Upload Media Exif Date
     *
     * The original filter hook('umed_postdate'),
     * Get the date and time from the file name when the date and time cannot be read from the EXIF.
     *
     * @param string $filename  filename.
     */
    function umed_postdate_from_filename( $filename ) {
    
        /* Sample for 20191120_183022.jpg */
        $year = substr( $filename, 0, 4 );
        $month = substr( $filename, 4, 2 );
        $day = substr( $filename, 6, 2 );
        $hour = substr( $filename, 9, 2 );
        $minute = substr( $filename, 11, 2 );
        $second = substr( $filename, 13, 2 );
    
        $postdate = $year . '-' . $month . '-' . $day . ' ' . $hour . ':' . $minute . ':' . $second;
    
        return $postdate;
    
    }
    add_filter( 'umed_postdate', 'umed_postdate_from_filename', 10, 1 );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Feature request’ is closed to new replies.