Benjamin
Forum Replies Created
-
That’s quite unusual.
Do the gallery displays work, or is it only albums that are coming out blank?
Could you try doing this:
$albumID = 1; // insert your own logic $renderer = C_Displayed_Gallery_Renderer::get_instance(); $gallery_html = $renderer->display_images(array( 'album_ids' => array($albumID), 'display_type' => 'photocrati-nextgen_basic_extended_album' )); echo $gallery_html;That should create an album display; just use the same parameters you may pass to the shortcode.
Thanks for your report! I’ve committed a fix that should fix your problem; we recently made an update that broke nggdb::get_gallery()’s search by slug. I can’t say exactly when this will be released (but we do hope it will be soon), if you’d like to upgrade to .76 you can fix this by altering nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/lib/ngg-db.php and replacing line 125’s
$image_mapper->select()->where(array("galleryid = %d", $id));withif (is_numeric($id)) $image_mapper->select()->where(array("galleryid = %d", $id)); else $image_mapper->select()->where(array("slug = %s", $id));I’ve tried your template and it is working correctly for me; is there a specific warning or error being emitted that you are seeing with your template?
PS we should be fixing soon in a point release, the results of $nggdb->get_gallery() should always be a C_Image_Wrapper.
It appears we did deprecate that method. Could you try using
C_Album_Mapper::get_instance()->find_all()as a replacement?We’ve been slowly replacing some of our older methods with a more extensible framework for NextGen 2.0+: it looks like in this case we turned one of our legacy methods into a wrapper that doesn’t return exactly the right thing.
Could you try one of the following:
1) insert$storage = C_Gallery_Storage::get_instance();above your call to $nggdb->get_gallery()
2) insert$image->imageURL = $storage->get_image_url($image, 'full');as the first line in your foreach()OR
1) change foreach($gallery as $image) to foreach($gallery as $dbimg) and add
$image = new C_Image_Wrapper($dbimg);first thing in the foreach()? That should provide the same attributes to the $image object you would expect from $nggdb->get_gallery()We’ve been removing some of the legacy API methods in favor of our more-extensible framework we’ve built for NextGen 2.0+, but looking at the code for NextGen 1.9.13 I don’t see a get_all_album() method.
I can restore the method as a wrapper to our new API if it would help, but I’m not seeing that method having been part of NextGen.
The numbers are generated in nextgen-gallery/products/photocrati_nextgen/modules/dynamic_thumbnails/class.dynamic_thumbnails_manager.php in get_name_from_params()
The following code will retrieve the gallery & image and then give you the path to the image full URL, a dynamicly generated clone, and the official thumbnail:
<?php $dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance(); $gallery_mapper = C_Gallery_Mapper::get_instance(); $image_mapper = C_Image_Mapper::get_instance(); $gallery = $gallery_mapper->find($gallery_id); if (!empty($gallery->previewpic) { $image = $image_mapper->find($gallery->previewpic); $dynamic_parameters = array( 'width' => '100', 'height' => '100', 'quality' => '100', 'crop' => TRUE, 'watermark' => FALSE ); $thumbnail_size_name = $dynthumbs->get_size_name($dynamic_parameters); $full_url = $storage->get_image_url($image, 'full'); $dynamic_url = $storage->get_image_url($image, $thumbnail_size_name, TRUE); $thumb_url = $storage->get_image_url($image, 'thumb'); }I hope that helps!
My apologies, I was wrong–the basic slideshows ID is set in adapter.nextgen_basic_slideshow_controller.php to
'ngg-slideshow-' . $displayed_gallery->id() . '-' . rand(1, getrandmax()) . $current_pagewhich will definitely add an unwanted random number to the ID. This is evidently meant for compatibility in case the same slideshow is present more than once on a page, but it was implemented incorrectly.I’ve made a note of this to try to get it fixed in the next major release, but until then you could try editing
nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/slideshow/index.phpto adddata-gallery-id='<?php esc_attr_e($displayed_gallery_id); ?>'to the div.ngg-slideshow-image-list element.I have to apologize, this isn’t provided by the theme at all but is a feature of NextGen I’d forgotten about.
You should be able to add the following to the end of your theme’s functions.php (regardless of theme):
add_filter('the_title', 'fix_ngg_title', 10, 3); function fix_ngg_title($title, $id) { preg_match('/^Images tagged "(.*)"$/', $title, $matches); if (!empty($matches)) { return "Foobar: {$matches[1]}"; } return $title; }Where $matches[1] will have the tag name.
In future releases I’ll try to make this easier or more direct to filter. I hope this helps!
It is provided by your theme, but I think you could remove it by adding a filter to “the_title”
This is a bit more difficult than it used to be because NextGen can now display multiple galleries together. What you would want to do is this:
$imap = C_Image_Mapper::get_instance(); $gmap = C_Gallery_Mapper::get_instance(); $storage = C_Gallery_Storage::get_instance(); foreach ($gallery->displayed_gallery->container_ids as $id) { $image = $imap->find($gmap->find($id)->previewpic); var_dump($image); var_dump($storage->get_image_url($image, 'thumb')); var_dump($storage->get_image_url($image, 'full')); }That will display the image information itself followed by the URL to its thumbnail and the fullsize version.
I hope that helps!
That is in nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/lib/post-thumbnail.php in method ajax_set_post_thumbnail()
The gallery ID shouldn’t change on every page load, only if you change the settings to that gallery.
Are you using a shortcode or the Attach-To-Post window, or is your gallery a ‘random’ one?