WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
FYI - A better method to read XMP... (1 post)

  1. JS Morisset
    Member
    Posted 1 year ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic