WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: NextGEN Gallery] patch for reading XMP meta data (1 post)

  1. nadavkav
    Member
    Posted 4 years ago #

    here is a new version of the extract_XMP() function that reads the content of the image file (successfully). using the output buffer (ob_start() functions) was not successful on my server. not sure why?

    function extract_XMP( $filename ) {

    //TODO:Require a lot of memory, could be better
    // ob_start();
    // @readfile($filename);
    // $source = ob_get_contents();
    // ob_end_clean();

    $image_handle = fopen($filename, "r");
    $image_contents = fread($image_handle, filesize($filename));
    fclose($image_handle);

    $start = strpos( $image_contents, "<x:xmpmeta" );
    $end = strpos( $image_contents, "</x:xmpmeta>" );
    if ((!$start === false) && (!$end === false)) {
    $lenght = $end - $start;
    $xmp_data = substr($image_contents, $start, $lenght+12 );
    unset($image_contents);
    return $xmp_data;
    }

    unset($source);
    return false;
    }

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.