c# - Export / Import Files from umbraco CMS Media -
as need export media files umbraco v 4.5.2 umbraco v 6.0.5 ,
is there way or such package through can same.
you can bulk import content using cmsimport package (http://our.umbraco.org/projects/developer-tools/cmsimport). if created file referenced site images import them under content node on new installation.
this bit of example razor code run round media images can list them out:
@using umbraco.cms.businesslogic.media; @using ucomponents.core; @using ucomponents.core.uqueryextensions; @using system @{ // set default media root node id int rootnodeid = -1; // media node , iterate children var m = new media(rootnodeid); var imagesandfolders = m.getchildmedia(); var sortedlist = m.getchildmedia().orderby(y => y.text).orderby(x => x.contenttype.alias); @{ foreach (var c in sortedlist) { var type = c.contenttype.alias; switch (type) { case "folder": //drill folder break; default: var filepath = c.getpropertyasstring("umbracofile"); var thumbpath = c.getpropertyasstring("umbracofile").replace(".","_thumb."); var width = c.getpropertyasstring("umbracowidth"); var height = c.getpropertyasstring("umbracoheight"); //allowing build table of images <a href="@filepath">@c.text</a> <a href="@filepath" class="imagepreview">preview »</a> <a href="@filepath" itemprop="contenturl" download="@c.text"><img itemprop="thumbnailurl" src="@thumbpath" alt="@c.text" /></a> break; } } } }
Comments
Post a Comment