WordPress.org

Support

Support » How-To and Troubleshooting » Adding EXIF fields to wp_read_image_metadata

Adding EXIF fields to wp_read_image_metadata

Viewing 5 replies - 1 through 5 (of 5 total)
  • 1. if u want to manipulate the exif_data u need to pass a image filename to the variable $file

    2. the exif_read_data function said that you can’t use a URL of a image to grab the information so it would be something like physical file location

    Thankyou. That explains why my fleeting attempt with the metadata url didn’t work.

    Do you know how this applies to the context of image.php? I have been tracking this variable across several files and just don’t know how it applies to the current image being uploaded.

    Your point #2 may explain the part of wp-admin/includes/image.php which says

    // Make the file path relative to the upload dir
    		if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { // Get upload directory
    			if ( 0 === strpos($file, $uploads['basedir']) ) {// Check that the upload base exists in the file path
    				$file = str_replace($uploads['basedir'], '', $file); // Remove upload dir from the file path
    				$file = ltrim($file, '/');
    			}

    However $file is still coming through as a function parameter into that function.

    its most probably the data is not passed to the filter.. i’m not sure about image.php .. if you have a working hack of image.php , it might help others to understand what you want to achieve..

    You need to call add_filter with more parameters. By default your filter will only have 1 parameter. To use three, change the last line of your code to the following:

    add_filter(‘wp_read_image_metadata’, ‘add_geo_exif’, , 3);

    More info here (see “Hook in your filter”):

    http://codex.wordpress.org/Plugin_API#Filters

    Thank you both for your time and help!

    It wasn’t grabbing $file because there was only 1 parameter being passed! Nice one Ben!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding EXIF fields to wp_read_image_metadata’ is closed to new replies.
Skip to toolbar