1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Solution: How to insert images into SiteFinity using ASP.NET or HTML image tags

Solution: How to insert images into SiteFinity using ASP.NET or HTML image tags

6 posts, 1 answered
  1. Doug Lubey
    Doug Lubey avatar
    31 posts
    Registered:
    17 Apr 2010
    26 Jan 2012
    Link to this post
    By Default SiteFinity does not allow you to use images using HTML or ASP.NET IMAGE TAGS:

    Solution: 
    we use \App_Themes\Images
    we use the CSS \App_Themes\OurCompanNameTemplate.css

    What did not work:
    \images\imagename.png

    What did work:
    <img src="../../App_Themes/Images/icon_CourseCategoryHeading.PNG" border=0 vspace=0>

    Thanks,
    Doug Lubey of Louisiana


    Search engine tags:
    img tag src
    <img src source
    img tag src image folder
    <asp:image
    ASP.NET MASTER PAGES
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    31 Jan 2012
    Link to this post
    Hi Doug,

    Could you please give us some more details about your issue? Where do you enter the image - in a content block inside a page or as ASP.NET markup in a .master page? You can't enter ASP.NET tags in a content block but you can use the insert image dialog that is part of the rich Html field used to edit the content block contents.

    Regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Doug Lubey
    Doug Lubey avatar
    31 posts
    Registered:
    17 Apr 2010
    31 Jan 2012
    Link to this post
    The problem occured.

    Using imag tags (html or asp.net image tags) nside of a control.  The control is ultimately used inisde of a virtual page inside site finity.

    yes: Hard coding the URL (inlcuding the http; etc)
    ....worked fine.

    But I was looking for relativity....


  4. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    31 Jan 2012
    Link to this post
    Hi Doug,
    I believe what you've encountered is a "bug" that was introduced with Sitefinity 4 (Telerik will tell you it's a feature). The issue is that the images module uses the /images/ name it the path and as you've noticed in another post the SF URL rewriting is very intrusive and prevents you from using the /images/ folder yourself. There is a way to change the image module to use something different i.e. "/imagelib/" but if you've already got images uploaded it's a pain and you'd have to worry about compatibility with upgrades etc. The easiest solution is to change your current /images/ folder to something like /img/ and then your images should display just fine.

    Hope I understood your issue and that helps out. Also, I'm sure it's just a typo but in your example of "solution" and what "did not work" you're using backslashes instead of forward slashes.

    Cheers,
    Phill
    Answered
  5. Doug Lubey
    Doug Lubey avatar
    31 posts
    Registered:
    17 Apr 2010
    31 Jan 2012
    Link to this post
    That would be correct; I will mark your answer as correct;

    here is an example which works too:

    <asp:Image ID="Image2" runat="server" ImageUrl="~/ImagesDoug/slide4.png" />


  6. Tim
    Tim avatar
    258 posts
    Registered:
    22 Jun 2011
    01 Feb 2012
    Link to this post
    This has been brought up quite a few times but I, still, really have to disagree that the way Sitefinity handles images is inconvenient. The website templates file structure shows how custom templates and themes should be constructed. If we follow it, the end result is a very organized and portable package.

    To access files inside of your theme, you can use something like this:
    /Sitefinity/WebsiteTemplates/AwesomeTemplateName/App_Themes/AwesomeThemeName/Images/logo.png

    If an "Images" folder is required, because of existing code, then this knowledge base article covers how to change the default behavior.

    My point is, like I said a moment ago, the recommended structure hasn't ever caused me an issue. It's really the way to go. :)
6 posts, 1 answered