Replies
Hello Brajesh,
Thank you for look into it.
Yes, it’s understandable from error that Media(Image) I uploaded is marked as not supported.
But on other hand when I uploaded same Image in same gallery from admin side then it’s perfectly added then how it’s start supporting that time.
I tried with many different Images.
also I checked the settings, “jpeg,jpg,gif,png” is allowed extension for photo.
Please correct me if I have to check anything more.
Regards,
Karamveer SinghHello Brajesh,
I added/uploaded jpeg image from admin side and pass the attachment_id then below is the var_dump output of the $result.
object(WP_Error)#2175 (3) {
[“errors”]=>
array(1) {
[“invalid_type”]=>
array(1) {
[0]=>
string(19) “Invalid media type.”
}
}
[“error_data”]=>
array(0) {
}
[“additional_data”:protected]=>
array(0) {
}
}
{“success”:false,”data”:”Invalid media type.”}Regards,
Karamveer SinghHi Brajesh,
I tried your given solution but not succeed, steps are used as below.
*Activities performed*-
1. Upload JPEG image in Media, from admin side.
2. Created Galleries programmatically.
3. Get and Use Attachment ID created in step 1.
4. Get and Use Gallery ID created in step 2.
5. Execute $result = mpp_import_attachment( $attachment_id, $gallery_id, $override = array() );Regards,
Karamveer SinghHi 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 SinghHi 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 SinghHello Brajesh,
As you suggested I enabled the Mediapress on individual site basis and tried media uploading then assigning media/photos to Mediapress Gallery by using switch_to_blog(2);
it uploading the images to media but still not assigning the media to required Gallery.
do you have some reference code snippet to achieve it.
*Activities performed*-
1. Setup the fresh WP-MU
2. Created 2 subsites
3. Visited the individual single site and enabled the media press plugin
4. Executed my custom script to sync the media but still the same result. Images are saved into the media but not mapped with the Gallery. The gallery is showing empty no media attached/thumbsRegards,
Karamveer Singh- This reply was modified 1 year, 5 months ago by karamveer.