{"id":651,"date":"2018-04-23T12:48:01","date_gmt":"2018-04-23T12:48:01","guid":{"rendered":"https:\/\/buddydev.com\/mediapress\/?p=651"},"modified":"2018-04-23T12:48:01","modified_gmt":"2018-04-23T12:48:01","slug":"import-wordpress-attachment-mediapress-gallery","status":"publish","type":"post","link":"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/","title":{"rendered":"Import a WordPress Attachment to MediaPress Gallery"},"content":{"rendered":"<p>MediaPress media files are just a sugarcoated version of WordPress attachment. There are differences in the image sizes and some properties and file storage locations.<\/p>\n<p>With MediaPress 1.3.6 and above, we have an API to import the WordPress attachment to a MediaPress Gallery.<\/p>\n<p><strong>mpp_import_attachment( $attachment_id, $gallery_id, $overrides = array() )<\/strong><\/p>\n<p><strong>Parameters:-<\/strong><\/p>\n<ul>\n<li>$attachment_id(required)(integer):- Valid WordPress attachment id.<\/li>\n<li>$gallery_id(required)(integer):- a valid MediaPress gallery id<\/li>\n<li>$overrides(optional)(array):- Override any extra property of the media.<\/li>\n<\/ul>\n<p><strong>Return:-<\/strong><\/p>\n<p>media id on success or WP_Error object on failure.<\/p>\n<p>Example:-<\/p>\n<p>mpp_import_attachment(215, 32);<\/p>\n<p>That will import WordPress attachment id 215 to our gallery if there is no error.<\/p>\n<p>What Happens Internally:-<\/p>\n<ul>\n<li>We test for the validity of attachment<\/li>\n<li>We test for the validity of gallery<\/li>\n<li>If both are valid, we test if the media specified by the attachment is a valid type of media for MediaPress(e.g allowed file type)<\/li>\n<li>If all is well, we check that the gallery type can contain media of the given type.<\/li>\n<li>If we reach here, we copy the attached file(original file) from the attachment to the MediaPress&#8217;s gallery directory. Delete the various image sizes of the attchment(including the original)<\/li>\n<li>We regenerate the attachment meta data again(It will regenerate image sizes if the memdia type is photo)<\/li>\n<li>If everything goes well, return the media id which is same as the attachment id.<\/li>\n<li>If any of the above steps go wrong, we return an instance of WP_Error detailing the problem.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MediaPress media files are just a sugarcoated version of WordPress attachment. There are differences in the image sizes and some properties and file storage locations. With MediaPress 1.3.6 and above, we have an API to import the WordPress attachment to a MediaPress Gallery. mpp_import_attachment( $attachment_id, $gallery_id, $overrides = array() ) Parameters:- $attachment_id(required)(integer):- Valid WordPress attachment &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4557],"tags":[],"class_list":["clearfix","post-651","post","type-post","status-publish","format-standard","hentry","category-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Import a WordPress Attachment to MediaPress Gallery &#8226; MediaPress | BuddyDev<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Import a WordPress Attachment to MediaPress Gallery &#8226; MediaPress | BuddyDev\" \/>\n<meta property=\"og:description\" content=\"MediaPress media files are just a sugarcoated version of WordPress attachment. There are differences in the image sizes and some properties and file storage locations. With MediaPress 1.3.6 and above, we have an API to import the WordPress attachment to a MediaPress Gallery. mpp_import_attachment( $attachment_id, $gallery_id, $overrides = array() ) Parameters:- $attachment_id(required)(integer):- Valid WordPress attachment ...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/\" \/>\n<meta property=\"og:site_name\" content=\"MediaPress | BuddyDev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/bpdev\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-23T12:48:01+00:00\" \/>\n<meta name=\"author\" content=\"Brajesh Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sbrajesh\" \/>\n<meta name=\"twitter:site\" content=\"@buddydev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brajesh Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/\",\"url\":\"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/\",\"name\":\"Import a WordPress Attachment to MediaPress Gallery &#8226; MediaPress | BuddyDev\",\"isPartOf\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/#website\"},\"datePublished\":\"2018-04-23T12:48:01+00:00\",\"author\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb\"},\"breadcrumb\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/buddydev.com\/mediapress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Import a WordPress Attachment to MediaPress Gallery\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/#website\",\"url\":\"https:\/\/buddydev.com\/mediapress\/\",\"name\":\"MediaPress | BuddyDev\",\"description\":\"The Best Media Gallery Plugin For BuddyPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/buddydev.com\/mediapress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb\",\"name\":\"Brajesh Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/image\/\",\"url\":\"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon\",\"contentUrl\":\"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon\",\"caption\":\"Brajesh Singh\"},\"sameAs\":[\"http:\/\/buddydev.com\/members\/sbrajesh\/\",\"https:\/\/x.com\/sbrajesh\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Import a WordPress Attachment to MediaPress Gallery &#8226; MediaPress | BuddyDev","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/","og_locale":"en_US","og_type":"article","og_title":"Import a WordPress Attachment to MediaPress Gallery &#8226; MediaPress | BuddyDev","og_description":"MediaPress media files are just a sugarcoated version of WordPress attachment. There are differences in the image sizes and some properties and file storage locations. With MediaPress 1.3.6 and above, we have an API to import the WordPress attachment to a MediaPress Gallery. mpp_import_attachment( $attachment_id, $gallery_id, $overrides = array() ) Parameters:- $attachment_id(required)(integer):- Valid WordPress attachment ...","og_url":"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/","og_site_name":"MediaPress | BuddyDev","article_publisher":"https:\/\/www.facebook.com\/bpdev","article_published_time":"2018-04-23T12:48:01+00:00","author":"Brajesh Singh","twitter_card":"summary_large_image","twitter_creator":"@sbrajesh","twitter_site":"@buddydev","twitter_misc":{"Written by":"Brajesh Singh","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/","url":"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/","name":"Import a WordPress Attachment to MediaPress Gallery &#8226; MediaPress | BuddyDev","isPartOf":{"@id":"https:\/\/buddydev.com\/mediapress\/#website"},"datePublished":"2018-04-23T12:48:01+00:00","author":{"@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb"},"breadcrumb":{"@id":"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/buddydev.com\/mediapress\/media\/import-wordpress-attachment-mediapress-gallery\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/buddydev.com\/mediapress\/"},{"@type":"ListItem","position":2,"name":"Import a WordPress Attachment to MediaPress Gallery"}]},{"@type":"WebSite","@id":"https:\/\/buddydev.com\/mediapress\/#website","url":"https:\/\/buddydev.com\/mediapress\/","name":"MediaPress | BuddyDev","description":"The Best Media Gallery Plugin For BuddyPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/buddydev.com\/mediapress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb","name":"Brajesh Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/image\/","url":"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon","contentUrl":"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon","caption":"Brajesh Singh"},"sameAs":["http:\/\/buddydev.com\/members\/sbrajesh\/","https:\/\/x.com\/sbrajesh"]}]}},"_links":{"self":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/651","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/comments?post=651"}],"version-history":[{"count":1,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/651\/revisions"}],"predecessor-version":[{"id":652,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/651\/revisions\/652"}],"wp:attachment":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/media?parent=651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/categories?post=651"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/tags?post=651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}