Ready to get started?Download WordPress


Yet Another Photoblog
Exif code simplification (1 post)

  1. 308gv
    Posted 9 months ago #

    To simplify the code a bit, and make it more consistent with exif gathering in other plugins such as Exifography and phpThumb, I replaced the outdated phpExifRW with a call to the standard exif_read_data() from php.

    function getExifData($yapbImage, $flagUnfiltered=false) {
    			$result = null;
    			require_once realpath(dirname(__file__) . '/phpExifRW-1.1/exifReader.inc');
    			$phpExifReader = new phpExifReader($yapbImage->systemFilePath());
    			$phpExifReader->ImageReadMode = 1; // This should turn off EXIF thumbnail caching too
    			$result = $phpExifReader->getImageInfo();
    			$result = exif_read_data($yapbImage->systemFilePath(), 'EXIF', FALSE, FALSE);
    			// If the user wants his EXIF data filtered, we do that
    			if (get_option('yapb_filter_exif_data') && ($flagUnfiltered == false)) {
    				$result = ExifUtils::filterExifData($result);

    You can now delete the phpExifRW directory which pre-dates the implementation of exif_read_data() in Php 4.2
    I then retrained the filter, selected the new/standard names and voila. Less code to manage plus consistent naming across the various exif using tools.




You must log in to post.

About this Plugin

About this Topic