Benjamin
Forum Replies Created
-
Hi LovePS,
NextGen uses a handful of custom posts to store settings. Since the 2.0 release we introduced a few new ideas beyond plain albums and galleries. Since we organize our plugin to be as modular as possible we split up the methods for generating a thumbnail gallery from an imagebrowser gallery, so our “basic thumbnails” is one “Display type” and the “basic imagebrowser” another. Each display type is its own module and has its own code for handling display, settings, etc. Each display type will create its own custom post to store the global settings you see in the “Gallery Settings” page.
A “displayed gallery” is created by our “Attach To Post” window and is the equivalent of a serialized shortcode. It contains all the settings that display needs like which galleries it comes from (a “displayed gallery” can show images from multiple “galleries”, thus the distinction).
The “displayed gallery source” post is again used to store some internal settings. NextGen 2 has several ‘sources’ — galleries, albums, ‘recent’ images, ‘random’ images, and tags. A basic thumbnail displayed gallery could display all images tagged a certain way, but albums can only use albums as their source of content.
If you want to monitor when Attach-To-Post galleries are created you would want to inspect the “displayed gallery” type posts. If you’d like to monitor when any new displayed gallery is rendered you can use the “ngg_displayed_gallery_rendering” filter which provides the rendered HTML as well as the displayed-gallery object.
Let me know if you have any more questions! NextGen has several actions & filters to use, if you can be more specific about what you want to achieve I can help with what method may work best.
I’ve tried your snippet with NextGen 2.1.0 and I’m still only seeing a single /albums/ which does not work and requires changing the check_canonical_url() action from ‘wp’ to ‘template_redirect’ or checking ORIG_REQUEST_URI in addition to REQUEST_URI.
This shouldn’t be a problem with NextGen 2.1 anymore as we load the ATP iframe via admin_url() which should play nicely with WordPress-HTTPS. If this is still an issue please let me know-I could add a filter to WordPress-HTTPS’ ‘force_ssl’ to make our ATP preview always be HTTPS.
What are you naming your album template files?
You can use WordPress’ method do_shortcode() to return the results of a shortcode, thus in PHP you could do:
$galleryHTML = do_shortcode("[ngg_images source='tags' container_ids='motorrad' display_type='photocrati-nextgen_basic_thumbnails']");The results of get_static_url() should be a full URI (https://example.org/path/to/file.css) and not a relative path (/path/to/file.css). Are you defining your own WP_CONTENT_URL or WP_PLUGIN_URL constants? According to The Codex they should both be a full URL.
Hi markwebstar,
You’ll want to create a new directory in your active theme directory and name it “nggallery”. Place the following code in a file called singlepic-title-below.php in that directory:
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty($image)) { ?> <a href="<?php echo nextgen_esc_url($image->imageURL); ?>" title="<?php echo esc_attr($image->linktitle); ?>" <?php if(!empty($target)) { ?>target="<?php echo esc_attr($target); ?>"<?php } ?> <?php echo $image->thumbcode; ?>> <img class="<?php echo $image->classname; ?>" src="<?php echo nextgen_esc_url($image->thumbnailURL); ?>" alt="<?php echo esc_attr($image->alttext); ?>" title="<?php echo esc_attr($image->alttext); ?>"/> </a> <?php if (!empty($image->description)) echo esc_html($image->description); ?> <?php if (!empty($image->caption)) { ?><span><?php echo $image->caption; ?></span><?php } ?> <?php } ?>You may need to wrap the echo of the $image->description attribute in a span, div, p, etc as necessary.
We don’t have a way of displaying a count of every image in the page, though you could do it yourself by adjusting your galleries to use a custom template that increments a global variable each time the $image loop is processed.
Unfortunately we don’t currently support this well at all, but I think it’s a great feature request with only a little effort. I’ve checked in a new filter, ngg_datamapper_table_name, that will allow users to choose which table is read from. It should be in the next release.
I suppose it depends on what you are looking to do; the most generic answer would be that NextGen is built on an object framework called POPE (wp-content/plugins/nextgen-gallery/pope/) and the documentation for it is built into the unit tests. Unfortunately our emphasis on NextGen 2.0 has been on stability & performance and our POPE unit tests are now badly outdated (ignore any references to hooks as they have been removed) but reading them should tell you how the NextGen product/module/adapter/mixin pattern is handled.
We don’t have any documentation on how to use our new API, but I can answer any specific questions. The WP-CLI module (in wp-content/plugins/nextgen-gallery/products/photocrati-nextgen/modules/wpcli/module.wpcli.php) has a wrapper method to create new galleries and import images from the filesystem, you may be able to use that as a reference for how to import images with NextGen 2.
If you can or are willing to share your code with us I’d be glad to look it over and tell you how it needs to change.
Forum: Plugins
In reply to: [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] cookie__EC__TEST__ is created by a JS library we use (“EasyCookie”) that creates the cookie with a content of Date.toGMTString() and deletes it to determine if the library has read / delete access and can thus function. It doesn’t store any other information.
nggShowGalleryTags() was indeed deprecated as a method when we launched NextGen 2.0. You can replace it with the following shortcode
[ngg_images source='tags' container_ids='motorrad' display_type='photocrati-nextgen_basic_thumbnails']ordo_shortcode("[ngg_images source='tags' container_ids='motorrad' display_type='photocrati-nextgen_basic_thumbnails']");We still support custom templates from 1.9; you shouldn’t need to change anything with them. We look for custom templates (in order) in the child theme (from get_stylesheet_directory()), the parent theme (get_template_directory()), the examples from ngglegacy/view/, and WP_CONTENT_DIR/ngg/legacy/templates/
It is possible that NextGen would use our example template first because it named “gallery.php” if yours is also named the same. Try renaming your template to “gallery-custom.php” – that ought to fix your problem.
Hi appugappu,
Unfortunately this has been built into NextGen for some time and we don’t have an easy way to disable it. The best solution I can think of to prevent an image from being created that may conflict would be to add a filter to “sanitize_file_name” and use it to search the gallery directories for the $filename parameter used in the filter. I would add this as an option but at the moment we’re in a feature freeze until we release our next update; we do take feature requests though.
If you’re willing to edit the nextgen-gallery plugin I would point you towards package.module.nextgen_data.php’s upload_base64_image() method; just look for the
if(!ini_get('safe_mode') && @file_exists($abs_filename)..line.Sorry I can’t help any more.
I should have mentioned this earlier but I think it could help if you add
define('NGG_DISABLE_FILTER_THE_CONTENT', TRUE)to your wp-config.php along with the NGG_DISABLE_RESOURCE_MANAGER constant.No, it isn’t currently possible with our latest beta (2.0.92), but it is definitely already a goal for the next major release.