• Resolved Jordy Meow

    (@tigroumeow)


    Hello,

    You actually contacted me to propose me a job πŸ™‚ But I like my independence. I proposed you to collaborate instead and to make our projects work together. Since that, you just disappeared. Tried to send you one or two more e-mails, no replies πŸ™ Please, for the sake of our users, and even for ourselves. Let’s make our plugins to work together. It’s an advantage for everyone here.

    I wanted you to help me implement support for your plugin but I am doing it myself since it seems there is no choice. However, I am running into one particular issue.

    I would like to reference an image that already exists in the Media Library in your ngg_pictures table. But it seems you only store files directly and their location depends on the gallery they belong to (ngg_gallery->path).

    1. Is there a way I could reference directly to an image in the Media Library?

    2. Alternatively, can I use one of your function to point to a specific media file and your plugin will copy it into a specific gallery/path?

    Thanks for your help.

    https://wordpress.org/plugins/nextgen-gallery/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @jordy Meow – As noted in your other topic, you are more than welcome to contact us via our Contact form here: http://nextgen-gallery.com/contact/

    If you did not receive any response to your previous message, please send it again just in case it got missed or lost to spam.

    We can then help you get in contact with one of our developers for additional assistance … we are also preparing additional general documentation that may be of further help as well.

    Also to note, we are a small team with limited resources, our developers may not have had time to digest your message and respond, yet.

    Thanks!

    – Cais.

    PS: I have also tagged this topic for our developers to review as well.

    Thread Starter Jordy Meow

    (@tigroumeow)

    Understood. It’s for the best of everyone including Photocrati, which is why. If possible, it would be great if someone could contact me directly at apps@meow.fr πŸ™‚

    Plugin Contributor photocrati

    (@photocrati)

    @jordy Meow – As noted, please use our contact form for the fastest results.

    – Cais.

    Thread Starter Jordy Meow

    (@tigroumeow)

    I contacted you 2 times already and the only answers I get are through this forum πŸ™ I just sent you another email through the link you gave me.

    Apart from that, can you give me support on those questions? That would definitely help:

    I would like to reference an image that already exists in the Media Library in your ngg_pictures table. But it seems you only store files directly and their location depends on the gallery they belong to (ngg_gallery->path).

    1. Is there a way I could reference directly to an image in the Media Library?

    2. Alternatively, can I use one of your function to point to a specific media file and your plugin will copy it into a specific gallery/path?

    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.

    Thread Starter Jordy Meow

    (@tigroumeow)

    Hey Benjamin, thanks a lot for helping πŸ™‚

    In my first question, I wanted to add the image my myself directly into the ngg_pictures table of NextGEN. That way I could have referenced something directly from the Media Library πŸ™‚

    The alternative you proposed me is better anyway because it uses NextGEN functions. I will do that.

    Thread Starter Jordy Meow

    (@tigroumeow)

    Hello,

    I have another question linked to the code you posted Benjamin. What about deleting this image from the library now? How to do it simply?

    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.

    Thread Starter Jordy Meow

    (@tigroumeow)

    Hello Benjamin!

    I figured that out, it was easy since it was still in that storage class. My “extension” for NextGEN allows synchronization with Lightroom but it doesn’t make you independent from NextGEN, you can basically use any gallery plugins or try another one, or use your themes galleries.

    If you want to see the code for the extension, it is here:
    https://github.com/jordymeow/wplr-nextgen

    Actually I think I still have an issue with NextGEN, is about the folder. I don’t know how they make a folder belongs to another one, I didn’t find the link between the two.

    Your documentation is really great, I will add a link to it in the plugin description, in case somebody wants to add a feature or do something specific. Thanks a lot for doing that!

    “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.

    Thread Starter Jordy Meow

    (@tigroumeow)

    Thanks a lot Benjamin. I have just released a new version of the extension. No more $wpdb, it’s always using NextGEN internal functions. Much better. Again, big thanks πŸ™‚

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘NextGEN WP/LR Sync’ is closed to new replies.