Support » Plugin: NextGEN Gallery - WordPress Gallery Plugin » FYI – A better method to read XMP…

  • FYI – My NextGEN Gallery code contains the following:

    function extract_XMP( $filename ) {
    
                    //TODO:Require a lot of memory, could be better
                    ob_start();
                    @readfile($filename);
            $source = ob_get_contents();
            ob_end_clean();
    
                    $start = strpos( $source, "<x:xmpmeta"   );
                    $end   = strpos( $source, "</x:xmpmeta>" );
                    if ((!$start === false) && (!$end === false)) {
                            $lenght = $end - $start;
                            $xmp_data = substr($source, $start, $lenght+12 );
                            unset($source);
                            return $xmp_data;
                    }
    
                    unset($source);
                    return false;
            }

    May I suggest having a look at http://surniaulula.com/2013/04/09/read-adobe-xmp-xml-in-php/ for a better performing solution? 😉

    Thanks,

    js.

    http://wordpress.org/extend/plugins/nextgen-gallery/

  • The topic ‘FYI – A better method to read XMP…’ is closed to new replies.