Support » Plugin: NextGEN Gallery Image Chooser » NGG Image Chooser Toolbar Button Issue

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author umertin

    (@umertin)

    It seems that photocrati have renamed or changed the function that my plugin uses to determine the existence of the nextgen gallery plugin. So I will have to adjust my plugin to the new name and possibly changed functionality.
    Unfortunately the new nextgen gallery versions (both 2.0.0 and 2.0.7) break my URL rewriting, so I cannot install them. Which means that it probably will be some time until I can do the modifications.
    Sorry. 🙁 I promise that I will get to it as soon as possible.

    Plugin Author umertin

    (@umertin)

    As my problems with the nextgen gallery persists, I have set up a test instance of WordPress 3.6 with NextGen Gallery 2.0.7 and NextGEN Gallery Image Chooser 1.0.0. In this instance the image chooser works without any issues. So it does not seem to be a general problem, but due to your specific installation.

    Are you sure you have enabled the NextGen Gallery plugin and not just installed it? That’s the only cause I can think of.

    I have the same issue
    version of your plugin 1.0.0
    WP 3.6.1
    NGG 2.0.31

    I get the following response:
    No data received

    Unable to load the webpage because the server sent no data.
    Error code: ERR_EMPTY_RESPONSE

    Plugin Author umertin

    (@umertin)

    @baspisa
    I’m using exactly the same combination in my installation, and cannot reproduce your error. So, to have any chance to fix this, I need some more information.

    • Do you get the error in the main window, or the pop-up?
    • Is this a fresh installation, or did the error occur after an update?
    • Which other plugins do you use? Have you tried disabling all plugins except the gallery and the image chooser?
    • Which language do you use?

    Hi Umertin,

    Error occures in the pop up.
    Error occurs when updating to NGG 2.0.31. It still works fine if i downgrade NGG to 1.9

    Site is in english (back-end as well)

    Can’t check the plugins at the moment. Will do when I get home from work.

    regards
    Bas

    Additional update: just tested it on my test server and there it also occures (So that is a different install of everything)

    Okay just did a quick test on my test server, deactivated all plugins but yours and NGG and error still occurs. So dont know how I can help you further

    Plugin Author umertin

    (@umertin)

    Thanks for the additional information. I just created a fresh test installation, installed ngg 1.9.13, the image chooser plugin, and then upgraded ngg to 2.0.31, but still no problem 🙁
    I even switchted to a language not supported by the image chooser, but it simply fell back to English.

    So there must be something to your specific constellation (which is common to both your production and test servers) that causes the image chooser to fail.

    I only can recommend uninstalling the image chooser (not the gallery!) and reinstalling it.

    If this doesn’t help, I’m at my wit’s end. Sorry.

    Deleted it, and re-installed, no succes.

    It opens a new window with url mydomain.net/wp-content/plugins/nextgen-gallery-image-chooser/nextgen-ic.php?nggic_tinymce=1&ver=358-25336

    but there is also no difference in URL when i switch NGG versions

    What is new now with version 1.9.13 is the following

    Warning: key_exists() [function.key-exists]: The first argument should be either a string or an integer in /wp-content/plugins/nextgen-gallery-image-chooser/nextgen-ic.php on line 155
    
    Warning: key_exists() [function.key-exists]: The first argument should be either a string or an integer in /wp-content/plugins/nextgen-gallery-image-chooser/nextgen-ic.php on line 155

    Plugin Author umertin

    (@umertin)

    There seems to be something unexpected in your album or gallery metadata. As this only is a warning, I don’t know if this is the reason for the failure, but it might be.
    To further analyze this, I need the data structure that the NextGen Gallery delivers to my plugin. I have created a debug version of the plugin file. Please create a backup copy of nextgen-ic.php in wp-content/plugins/nextgen-gallery-image-chooser/, put the debug code below in the original file, open a post and press the image chooser button (with NextGen Gallery 2.x installed). In the pop up window you should see the array with the albums and galleries. You can edit the names and slugs to hide private information, but must leave the rest, so I might see what causes the problem.

    <?php
    /*
    Plugin Name: NextGEN Gallery Image Chooser
    Plugin URI:
    Description: Comfortable image chooser for the NextGEN Gallery. Based on g2image.
    Version: 1.0.0
    Author: Ulrich Mertin
    Author URI: http://www.ulrich-mertin.de
    */
    
    /*
        This plugin is based on g2image by Kirk Steffensen,
        see http://g2image.steffensenfamily.com/ for further contributors.
    
        Released under the GPL version 2.
        A copy of the license is in the root folder of this plugin.
    */
    
    global $wpdb, $ngg, $wp_version, $nggdb;
    
    // ====( Version Info )
    $nggic_version_text = '1.0.0';
    
    // Is this a TinyMCE window?
    if(!isset($_REQUEST['nggic_tinymce']) && !isset($_SESSION['nggic_tinymce'])) {
    	//Activate & Deactivate Plugin Functions
    	register_activation_hook( __FILE__, 'nggic_pluginactivate' );
    	register_deactivation_hook( __FILE__, 'nggic_plugindeactivate' );
    	// Image Chooser Buttons - Visual Editor
    	add_action('init', 'nggic_init');
    	add_action('init', 'nggic_addbuttons');
    
    	// Create admin menu
    	if ( is_admin() ) {
    		require_once (dirname (__FILE__) . '/admin/admin.php');
    		$nggicAdminPanel = new nggicAdminPanel();
    	}	
    
    	return;
    }
    
    // ====( Initialization Code )
    require_once('../../../wp-load.php');
    
    // ====( NextGEN Gallery validation )
    
    if (!function_exists('nggShowGallery')) {
      die(__('Required NextGEN Gallery was not found!', 'nggic'));
    }
    
    // ====( Main HTML Generation Code )
    
    echo nggic_make_html_header();
    
    $debbugalbums = $nggdb->find_all_album('id');
    echo "<h3>Data Structure</h3>\n<pre>\n";
    print_r($debbugalbums);
    echo "</pre>\n";
    echo '</body>' . "\n\n";
    echo '</html>';
    
    // $_SESSION['nggic_last_album_visited'] = $nggic_options['current_gallery'];
    
    // ====( Functions - Alphabetical by Function Name)
    
    /**
    * Adds nggic to the TinyMCE button Toolbar
    *
    * @param null
    * @return null
    */
    function nggic_addbuttons() {
    	// Don't bother doing this stuff if the current user lacks permissions
    	if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
    		return;
    
    	// Add only in Rich Editor mode
    	if ( get_user_option('rich_editing') == 'true') {
    		add_filter("mce_external_plugins", "nggic_plugin");
    		add_filter('mce_buttons', 'nggic_wp_extended_editor_mce_buttons');
    	}
    }
    
    /**
    * Initializes NextGEN Gallery Image Chooser
    *
    * @param null
    * @return null
    */
    function nggic_init() {
    	// load translation
    	load_plugin_textdomain( 'nggic', false, dirname( plugin_basename( __FILE__ ) )  . '/langs/' );
    }
    
    /**
     * Make the header
     *
     * @return string $html The HTML for the header
     */
    function nggic_make_html_header(){
    	global $nggic_options;
    	$html = '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n"
    	. '<head>' . "\n"
    	. '    <title>' . __('NextGEN Gallery Image Chooser', 'nggic') . '</title>' . "\n"
    	. '    <link rel="stylesheet" href="css/nggic.css" type="text/css" />' . "\n"
    	. '    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' . "\n"
    	. '</head>' . "\n\n"
    	. '<body id="nggic">' . "\n\n";
    
    	return $html;
    }
    
    /**
    * Adds nggic to the TinyMCE plugins list
    *
    * @param string $plugins the buttons string from the WP filter
    * @return string the appended plugins string
    */
    function nggic_plugin($plugin_array) {
       $plugin_array['nggic'] = plugins_url( 'editor_plugin.js' , __FILE__ );
       return $plugin_array;
    }
    
    /**
    * Sets up the NGGIC Plugin defaults
    *
    * @param NULL
    * @return NULL
    */
    function nggic_pluginactivate() {
    	global $nggic_options;
    
    	if (!function_exists('nggShowGallery')) {
    		die(__('Required NextGEN Gallery was not found!', 'nggic'));
    	}
    
    	// Get NGGIC Option Settings
    	$nggic_options = get_option('nggic_options');
    
    	// Has NGGIC Plugin Not been correctly deactivated as Options should not yet exist.
    	if ($nggic_options['sortby']) {
    		// Add BTEV Event Message
    		if (function_exists('btev_trigger_error')) {
    			btev_trigger_error('NextGEN Gallery Image Chooser PLUGIN WAS NOT DEACTIVATED', E_USER_NOTICE, __FILE__);
    		}
    		nggic_plugindeactivate();
    		$nggic_options = '';
    	}
    
    	include_once (dirname (__FILE__). '/init.php');		// default settings
    
    	update_option('nggic_options', $nggic_options);
    
    	// Add BTEV Event Message
    	if (function_exists('btev_trigger_error')) {
    		btev_trigger_error('NextGEN Gallery Image Chooser PLUGIN ACTIVATED', E_USER_NOTICE, __FILE__);
    	}
    
    }
    
    /**
    * Removes all the NGGIC settings
    *
    * @param NULL
    * @return NULL
    */
    function nggic_plugindeactivate() {
    
    	// Delete NGGIC Option Settings
    	delete_option('nggic_options');
    
    	// Add BTEV Event Message
    	if (function_exists('btev_trigger_error')) {
    		btev_trigger_error('NextGEN Gallery Image Chooser PLUGIN DEACTIVATED', E_USER_NOTICE, __FILE__);
    	}
    
    }
    
    /**
    * Adds nggic to the TinyMCE button bar
    *
    * @param string $buttons the buttons string from the WP filter
    * @return string the appended buttons string
    */
    function nggic_wp_extended_editor_mce_buttons($buttons) {
    	array_push($buttons, 'separator', 'nggic');
    	return $buttons;
    }
    
    ?>

    First! Thanks for your help!

    her is the response from the debug version.

    Data Structure
    Array
    (
        [1] => stdClass Object
            (
                [id] => 1
                [name] => Photo Galleries
                [slug] => photo-galleries
                [previewpic] => 51
                [albumdesc] => Main photo gallery
                [sortorder] => a:3:{i:0;s:2:"a2";i:1;s:2:"a3";i:2;s:2:"a4";}
                [pageid] => 403
                [galleries] => Array
                    (
                        [0] => a2
                        [1] => a3
                        [2] => a4
                    )
    
            )
    
        [2] => stdClass Object
            (
                [id] => 2
                [name] => test 1
                [slug] => test-1
                [previewpic] => 107
                [albumdesc] => Dit is een test album
                [sortorder] => WyJhMiIsImEzIiwiYTQiXQ==
                [pageid] => 412
                [galleries] => Array
                    (
                        [0] =>
                    )
    
            )
    
        [3] => stdClass Object
            (
                [id] => 3
                [name] => test 2
                [slug] => test-2
                [previewpic] => 35
                [albumdesc] => En een tweede test album
                [sortorder] => a:3:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"3";}
                [pageid] => 416
                [galleries] => Array
                    (
                        [0] => 1
                        [1] => 2
                        [2] => 3
                    )
    
            )
    
        [4] => stdClass Object
            (
                [id] => 4
                [name] => Personal Selection
                [slug] => personal-selection
                [previewpic] => 108
                [albumdesc] => My personal selection of pictures that I really like. And not always for a specific reason
                [sortorder] => WyI5IiwiMTAiLCIxMSIsIjciLCIxMyIsIjEyIl0=
                [pageid] => 430
                [galleries] => Array
                    (
                        [0] =>
                    )
    
            )
    
    )

    hope this will help

    Plugin Author umertin

    (@umertin)

    Ok, as I expected, the albums number 2 and 4 have strange gallery entries ([0] =>) meaning the album has a child object (album or gallery) but NextGen Gallery won’t tell anything about it. So the image chooser does not know what to do with it.
    I expect either corrupted data in your database, a permission issue, or a bug in NextGen Gallery, as an entry without an id definitely is wrong. But this is out of my area of expertise, as I simply call a function of the gallery.

    Anyway, I have put an updated version of nextgen-ic.php here (zipped, so the web server does not attempt to interpret it). This new version simply ignores the empty entries, as this is the best I can do if the gallery doesn’t tell me anything about the object.

    Can you please try this version and let me know if it cures the warnings and possibly also the error?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘NGG Image Chooser Toolbar Button Issue’ is closed to new replies.