• Resolved ProImpactLLC

    (@proimpactllc)


    I have read the previous posts concerning the error message that NextGen Gallery creates when trying to upload sitemap.
    The Error Message I am getting is This is not a valid URL. Please correct it and resubmit. Count 16 which is the exact number of images that I have in a slideshow located on the Homepage. If I delete the slideshow, Google reports no errors.

    The previous post that I read indicated that they took the following action:

    i’ve fixed mine by adding the following line

    $newimage[‘src’] = $image->imageURL;

    just above the line

    $this->images[$src] = $newimage;

    in the add_gallery function in the ngg sitemap.php file

    I have taken that action and I am still getting the error message. Thinking that this might only to pertain to new images, I deleted the old gallery/images and uploaded a new set to a gallery with a different name. Still having the same problem.

    WordPress: 3.4.1
    NextGen: 1.95

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Add

    $newimage['src'] = $image->imageURL;

    above:

    $this->images[$src] = $newimage;

    in both functions, i.e. in add_images functions also

    Thread Starter ProImpactLLC

    (@proimpactllc)

    OK… I must be looking at the wrong file to edit. Maybe that is why I can’t fix it.

    I’m looking at public_html/wp-content/plugins/nextgen-gallery/lib/sitemap.php

    I’m not finding $this->images[$src] = $newimage;

    Thread Starter ProImpactLLC

    (@proimpactllc)

    Here is the file that I am looking at (I did a complete search of the installation and this is the only sitemap.php that comes up for NextGen

    <?php
    /**
    * Main PHP Class for XML Image Sitemaps
    *
    * @author Alex Rabe
    * @version 1.0
    *
    *
    */
    class nggSitemaps {

    var $images = false;

    /**
    * nggSitemaps::__construct()
    *
    * @return
    */
    function __construct() {

    add_filter(‘wpseo_sitemap_urlimages’, array( &$this, ‘add_wpseo_xml_sitemap_images’), 10, 2);

    }

    /**
    * Filter support for WordPress SEO by Yoast 0.4.0 or higher ( http://wordpress.org/extend/plugins/wordpress-seo/ )
    *
    * @since Version 1.8.0
    * @param array $images
    * @param int $post ID
    * @return array $image list of all founded images
    */
    function add_wpseo_xml_sitemap_images( $images, $post_id ) {
    $newimage[‘src’] = $image->imageURL;
    $this->images = $images;

    // first get the content of the post/page
    $p = get_post($post_id);

    // Backward check for older images
    $p->post_content = NextGEN_Shortcodes::convert_shortcode($p->post_content);

    // Don’t process the images in the normal way
    remove_all_shortcodes();

    // We cannot parse at this point a album, just galleries & single images
    add_shortcode( ‘singlepic’, array(&$this, ‘add_images’ ) );
    add_shortcode( ‘thumb’, array(&$this, ‘add_images’ ) );
    add_shortcode( ‘nggallery’, array(&$this, ‘add_gallery’) );
    add_shortcode( ‘imagebrowser’, array(&$this, ‘add_gallery’ ) );
    add_shortcode( ‘slideshow’, array(&$this, ‘add_gallery’ ) );

    // Search now for shortcodes
    do_shortcode( $p->post_content );

    return $this->images;
    }

    /**
    * Parse the gallery/imagebrowser/slideshow shortcode and return all images into an array
    *
    * @param string $atts
    * @return
    */
    function add_gallery( $atts ) {

    global $wpdb;

    extract(shortcode_atts(array(
    ‘id’ => 0
    ), $atts ));

    // backward compat for user which uses the name instead, still deprecated
    if( !is_numeric($id) )
    $id = $wpdb->get_var( $wpdb->prepare (“SELECT gid FROM $wpdb->nggallery WHERE name = ‘%s’ “, $id) );

    $images = nggdb::get_gallery($id, ‘pid’, ‘ASC’, true, 1000);

    foreach ($images as $image) {
    $src = $image->imageURL;
    $newimage = array();
    if ( !empty($image->title) )
    $newimage[‘title’] = $image->title;
    if ( !empty($image->alttext) )
    $newimage[‘alt’] = $image->alttext;
    $this->images[$src] = $newimage;
    }

    return;
    }

    /**
    * Parse the single image shortcode and return all images into an array
    *
    * @param array $atts
    * @return
    */
    function add_images( $atts ) {

    extract(shortcode_atts(array(
    ‘id’ => 0
    ), $atts ));

    // make an array out of the ids (for thumbs shortcode))
    $pids = explode( ‘,’, $id );

    // Some error checks
    if ( count($pids) == 0 )
    return;

    $images = nggdb::find_images_in_list( $pids );

    foreach ($images as $image) {
    $src = $image->imageURL;
    $newimage = array();
    if ( !empty($image->title) )
    $newimage[‘title’] = $image->title;
    if ( !empty($image->alttext) )
    $newimage[‘alt’] = $image->alttext;
    $this->images[$src] = $newimage;
    }

    return;
    }

    }
    $nggSitemaps = new nggSitemaps();

    The file is /nextgen-gallery/lib/sitemap, but you’ve added one of $newimage['src'] = $image->imageURL; in a wrong place, after function add_wpseo_.

    I said you must add in add_images and add_gallery functions, not in add_wpseo_ function.

    Thread Starter ProImpactLLC

    (@proimpactllc)

    Duh! Not sure what I was thinking!
    Tizz, thanks for your patience. That fixed it.
    I appreciate the support.

    You’re welcome. You can mark this as resolved, but I hope that Photocrati fix it definitely.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: NextGEN Gallery] URL Invalid’ is closed to new replies.