Benjamin
Forum Replies Created
-
“NextGEN for Lightroom” looks good; the only suggestion I’d make is rather than calling $wpdb->delete() in remove_collection() I would use
C_Gallery_Mapper::get_instance()->destroy($gallery or $gallery_id, TRUE)as it will remove tags that are no longer associated with images, optionally remove the relevant directory for the gallery, invoke the “ngg_delete_gallery” action, and flush the displayed gallery rendering cache.Like Cais said, I’m one of the devs working on NextGen 🙂 I don’t browse through here often enough, most of the time Cais gets my attention on certain subjects.
The “sortorder” attribute was set by Alex Rabe ‘back in the day’ and is just an array of what entities belong to the album. To remove a gallery from an album you would just do unset($album->sortorder[3]) before having the mapper persist your change.
I am not a Lightroom user; alas I haven’t done any photo development since the days when it required hydroquinone.
Thanks CyberPK! This will be fixed in the next release.
I’ve checked in an update that adds two filters to control this: ngg_manage_galleries_items_order and ngg_manage_galleries_items_orderby. They’ll be controllable with the following:
add_filter('ngg_manage_galleries_items_orderby', 'set_ngg_orderby'); add_filter('ngg_manage_galleries_items_order', 'set_ngg_order'); } function set_ngg_order($order) { return 'DESC'; } function set_ngg_orderby($orderby) { return 'gid'; }This is the first update post-NextGen 2.1.7 so while it will get released there may be a wait before it is out.
The following change to nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-galleries.php can be applied however:
- $order = ( isset ( $_GET['order'] ) && $_GET['order'] == 'desc' ) ? 'DESC' : 'ASC'; - $orderby = ( isset ( $_GET['orderby'] ) && ( in_array( $_GET['orderby'], array('gid', 'title', 'author') )) ) ? $_GET['orderby'] : 'gid'; + if (!empty($_GET['order']) && in_array($_GET['order'], array('DESC', 'ASC'))) + $order = $_GET['order']; + else + $order = apply_filters('ngg_manage_galleries_items_order', 'ASC'); + + if (!empty($_GET['orderby']) && in_array($_GET['orderby'], array('gid', 'title', 'author'))) + $orderby = $_GET['orderby']; + else + $orderby = apply_filters('ngg_manage_galleries_items_orderby', 'gid');You can do that with the following:
C_Gallery_Storage::get_instance()->delete_image($image_id)I have some been working on some (still in progress, only roughly edited, and unofficial for now) documentation on the NGG API that may help.
The closest would be just examining the C_NextGen_Settings_Installer class’ comments: that file on BitBucket.
Not every entry is commented but most are.
Like Cais said Media-RSS is an extension to RSS meant for syndicating images and video. NextGen can optionally embed a meta-tag in your site’s header that allows browsers to automatically inform the users of the availability of that feed. It is not the same as WordPress’ feeds which will only generate RSS 0.92, RSS 1.0, RSS 2.0, and Atom.
What you need is the “Display galleries in feeds” option that will allow NextGen galleries to be rendered (rather than replaced with a link to your site) in the WordPress feeds.
You want the album ‘sortorder’ property. The following code will do what you want:
$album_id = 2; $mapper = C_Album_Mapper::get_instance(); $album = $mapper->find($album_id); $album->sortorder[] = '1'; // gallery id $album->sortorder[] = 'a1'; // prefix album ID with 'a' to add sub-albums $mapper->save($album);I have some (unofficial, still being written & edited) documentation on the NextGen mappers API you can find here for now that may help.
That looks pretty reasonable; I’ve included this change for the next release.
Thanks Faraon83!
You’re totally right; I hadn’t at the time considered themes – sorry about that.
I’ve updated the filter applied to provide the is_admin() check and make it also check the ngg_options option:
get_option('ngg_options')['always_enable_frontend_logic']By setting that attribute to TRUE and updating ngg_options then subsequent loading of the plugin should go as you desire. It will be in our next release, though I don’t know when exactly that will be.
Thanks programmin!
If you edit nextgen_lightbox_init.js you’ll see this:
selector.lightBox({ imageLoading: nextgen_lightbox_loading_img_url, imageBtnClose: nextgen_lightbox_close_btn_url, imageBtnPrev: nextgen_lightbox_btn_prev_url, imageBtnNext: nextgen_lightbox_btn_next_url, imageBlank: nextgen_lightbox_blank_img_url });Replace each of the variables on the right like so:
selector.lightBox({ imageLoading: 'lightbox-ico-loading.gif', imageBtnPrev: '/wp-content/themes/galerieBonheur/js/jquery.lightbox/lightbox-btn-prev.gif', // or like this.. // and so on });Which should fix your problem.
Thanks Joys66!
I’m afraid I don’t understand your first question but I can answer the second.
$id = 23; // insert your own Media Library attachment ID $abspath = get_attached_file($id); $file_data = file_get_contents($abspath); $file_name = M_I18n::mb_basename($abspath); $attachment = get_post($id); $storage = C_Gallery_Storage::get_instance(); $mapper = C_Image_Mapper::get_instance(); $image = $storage->upload_base64_image($gallery_id, $file_data, $file_name); // Potentially import metadata from WordPress $image = $image_mapper->find($image->id()); if (!empty($attachment->post_excerpt)) $image->alttext = $attachment->post_excerpt; if (!empty($attachment->post_content)) $image->description = $attachment->post_content; $image_mapper->save($image);All it requires is that NextGen be loaded and that you know your media library image ID. You can see more or less the above in action in a method named import_media_library_action() if you search the NextGen code.
Hi beermoney,
I think the SQL you have may have been changed or broken a little during copy/paste. Try the following:
DELETE FROM wp_ngg_pictures WHERE galleryid NOT IN (SELECT gid FROM wp_ngg_gallery);It only needs to be applied to your ($prefix)_ngg_pictures table.
Hi game_0ver,
The framework that NextGen 2 is built on will generate these warnings on recent PHP versions. We appreciate why they are generated but we do what we are intentionally. You can hide them by defining ‘NGG_HIDE_STRICT_ERRORS’ to TRUE or by altering your error reporting / display setting to not include E_STRICT.