Accessing theme images

Posted by Community Admin on 04-Aug-2018 18:14

Accessing theme images

All Replies

Posted by Community Admin on 01-Sep-2011 00:00

Sitefinity Support,

I am having an issue whereby I cannot access the images that I've already included as part of my theme.  In Administration - Files, I can navigate to App_Data/Sitefinity/WebsiteTemplates/%Name%/App_Themes/Default/images and can see the images file names there.  In Design - Page Templates, I have selected my custom master page template, selected Theme and I have selected my registered theme from the Set Theme dropdown.  I then click on Content and drag an image widget on to my template.  However, the problem is when I click "Select an Image" and then click on "From already uploaded" I do not see my images.  I can navigate in the browser using the direct URL to the images folder and I can access the image from there.  Why can't I access those images from within the Select an Image widget?

Thank you.


Posted by Community Admin on 03-Sep-2011 00:00

Image Selector widget doesn`t show images from your current theme folder. Its shows the images that are uploaded to the Image Library in different albums. 

You can make your own widget with the RadFileExplorer in it, configured to show only images of the current theme. Current theme can be set to the InitialPath property of the control.

Here is a sample code:

protected void Page_Load(object sender, EventArgs e)
            string[] paths = new string[] "~/App_Data/Sitefinity/WebsiteTemplates/" + GetCurrentTheme() + "/App_Themes/Default/images" ;
            // This code sets RadFileExplorer's paths
            RadFileExplorer1.Configuration.ViewPaths = paths;
            RadFileExplorer1.Configuration.UploadPaths = paths;
            RadFileExplorer1.Configuration.DeletePaths = paths;
            // Sets Max file size
            RadFileExplorer1.Configuration.MaxUploadFileSize = 10485760;
            // Enables Paging on the Grid
            RadFileExplorer1.AllowPaging = true;
            // Sets the page size
            RadFileExplorer1.PageSize = 20;
public static string GetCurrentTheme()
            Guid currentPageId = GetCurrentPageId();
            PageNode pn = GetPageNode(currentPageId);
            return GetPageTheme(pn);      
        public static Guid GetCurrentPageId()
            Guid pageId;
            PageSiteNode psn = SiteMapBase.GetActualCurrentNode();
            if (psn == null)
                PagesConfig pagesConfig = Config.Get<PagesConfig>();
                pageId = pagesConfig.HomePageId;
                pageId = psn.Id;
            return pageId;
        public static PageNode GetPageNode(Guid pageId)
            var pf = App.WorkWith().Page(pageId);
            return pf.Get();
        public static string GetPageTheme(PageNode pn)
            return (pn.Page.Template != null) ? pn.Page.Template.Theme : "";

This thread is closed