BuddyDev

Search

Pragmatically create mediapress Gallery!

Tagged: ,

  • Keymaster
    (BuddyDev Team)
    Posts: 24332
    Brajesh Singh on #49682

    Hi Karamveer,
    Thank you.
    the gallery is a post type as you might have guessed already.
    Can you please check if the gallery exists on the site in context? Also, the media from a specific site ca be added to gallery on that site(gallery is set as parent post of the media internally in MediaPress).

    Please let me know if these conditions have met? If yes, please share your complete code using pastebin to allow me try the same.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 20
    karamveer on #49689
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 24332
    Brajesh Singh on #49697
    This reply has been marked as private.
  • Participant
    Level: Initiated
    Posts: 20
    karamveer on #49701

    Hi Brajesh,

    https://github.com/buddydev/mediapress/blob/1.5-dev/core/ajax/mpp-ajax.php#L312

    I tried it and found above variable in $media_data looking to have POST File type data with => enctype=”multipart/form-data” headers.

    We can’t pass the values in that way as media already there on the server.

    I thought passing all static values(for testing) in $media_data may get some lead. We tried to assign all valid values to $media_data but not succeed.

    Please help us to fix this issue we just 1 step behind to conclude the requirement that is attach the media with gallery.

    Regards,
    Karamveer Singh

  • Keymaster
    (BuddyDev Team)
    Posts: 24332
    Brajesh Singh on #49703

    Hi Karamveer,
    Since you are able to successfully create an attachment, why not import it to gallery using

    
    mpp_import_attachment( $attachment_id, $gallery_id, $override = array() );
    

    This function calls import attachment internally whose implementation you can see here.
    https://github.com/buddydev/mediapress/blob/1.5-dev/core/media/class-mpp-media-importer.php#L44

    This should be straight forward solution for you.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24332
    Brajesh Singh on #49704

    Here is even easier suggestion.

    1. Use WordPress api to add file as an attachment
    2. Use the attachment id and import it to your gallery using the above solution

    You do not need to worry about upload locations etc as the plugin will take care of that.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 20
    karamveer on #49731

    Hi Brajesh,

    Thanks, I think the same API concept already using in our custom script no separate function is being used in the program.

    Furthermore will try it with the POSTMAN tool to check attachment is working or not and will get back to you.

    Would you please send me the media press endpoints to attach the media with Gallery?

    Regards,
    Karamveer Singh

  • Participant
    Level: Initiated
    Posts: 20
    karamveer on #49814

    Hi Brajesh,

    Just a follow-up on my last posted comments, do we’ve any updates please answer.

    Regards,
    Karamveer Singh

  • Keymaster
    (BuddyDev Team)
    Posts: 24332
    Brajesh Singh on #49827

    Hi Karamveer,
    I am sorry, I could not find time to work on it. I will post an example code this weekend.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 20
    karamveer on #49834

    Hi Brajesh,

    Thanks for the update, please help us to conclude it as early as our project is already delayed.

    Regards,
    Karamveer

You must be logged in to reply to this topic.

This topic is: not resolved