(828) 862-6667

Sitefinity Blogs


  • Little known Sitefinity configuration settings
  • More detailed examples for Sitefinity component usage
  • Work-arounds for Sitefinity limitations
  • Discoveries and Ah-Ha moments 

How to get images from a Sitefinity Library by Tag

by Rich Winslow | Jul 24, 2010

It took a little searching to find the logic for filtering image libraries by a tag, so I thought I'd post it here:

   Private Function GetLibraryImageList(ByRef strFileList() As String, ByRef strAuthorList() As String, ByRef strAltTextList() As String) As Boolean

       ' create sitefinity library manager
       Dim libManager As New LibraryManager("Libraries")
       Dim mgrContent as new ContentManager("Libraries")
       Dim lstTags as IList = Nothing

       Dim strImageName as String = ""
       Dim strImageAuthor as String = ""
       Dim strImageAltText as String = ""
       Dim intIndex as Integer = 0
       Dim lstImage as IContent
       Dim strImageItemInfo as String = ""

       Dim libImage as ILibrary = libManager.GetLibrary(ImageGalleryName)
       Dim listOfImages as IList = Nothing
       Dim strRequestedTagList() as String = Split(FilterTagList, ",")
       Dim strMimeType as String = ""

       ' get Library
       Dim parentIDs(1) as Guid
       parentIDs(0) = libImage.ID

       strFileList = Nothing
       strAuthorList = Nothing
       strAltTextList = Nothing

       If FilterTagList.Trim <> "" Then
          ' User is requesting tag filtering
          For Each strRequestedTag as String In strRequestedTagList
              ' Each requested tag to filter on
              listOfImages = mgrContent.GetContent(0, MaxImageCount, "Publication_Date desc", strRequestedTag)
          Next
       Else
          ' get all images For specific library
          listOfImages = libManager.GetImages(0, MaxImageCount, "Publication_Date DESC", parentIDs)
       End If

       ReDim strFileList(listOfImages.Count)
       ReDim strAuthorList(listOfImages.Count)
       ReDim strAltTextList(listOfImages.Count)

       For Each lstImage In listOfImages
          strImageName = lstImage.UrlWithExtension
          strImageAuthor = lstImage.GetMetaData("Author")
          strImageAltText = lstImage.GetMetaData("AlternateText")

          strFileList(intIndex) = strImageName
          strAuthorList(intIndex) = strImageAuthor
          strAltTextList(intIndex) = strImageAltText

          IntIndex += 1
       Next

       Return True
   End Function

4 Comments

  1. 1 air jordans 26 Apr


    louis vuitton utah through lv neverfull Station louis vuitton utah leather Road, when a louis vuitton damier ebene wallet city of white clothing, to see two men fighting, They utah louis vuitton want to pull, did not. louis vuitton utah bag
  2. 2 jordan 3 25 Apr
    Nike Air Jordan CDP Tourism Bureau retro jordans air jordan 9 retro cheap jordans 12 buy jordans 20 punish air jordan 1 sale travel market in Yunnan .
  3. 3 jordan 3 25 Apr
    [b][url=http://www.usretrojordans.com/nike-air-jordan-cdp-C30.html]Nike Air Jordan CDP[/url][/b]   Tourism Bureau  [b][url=http://www.usretrojordans.com/]retro jordans[/url][/b]  [b][url=http://www.usretrojordans.com/air-jordan-shoes-9-C9.html]air jordan 9 retro[/url][/b]        [b][url=http://www.usretrojordans.com/air-jordan-shoes-12-C12.html]cheap jordans 12[/url][/b]  [b][url=http://www.usretrojordans.com/air-jordan-shoes-20-C20.html]buy jordans 20[/url][/b] punish [b][url=http://www.usretrojordans.com/air-jordan-shoes-1-C1.html]air jordan 1 sale[/url][/b] travel  market in Yunnan .
  4. 4 jordan 3 25 Apr
    <b><a href="http://www.usretrojordans.com/nike-air-jordan-cdp-C30.html">Nike Air Jordan CDP</a></b>   Tourism Bureau  <b><a href="http://www.usretrojordans.com/">retro jordans</a></b>  <b><a href="http://www.usretrojordans.com/air-jordan-shoes-9-C9.html">air jordan 9 retro</a></b>        <b><a href="http://www.usretrojordans.com/air-jordan-shoes-12-C12.html">cheap jordans 12</a></b>  <b><a href="http://www.usretrojordans.com/air-jordan-shoes-20-C20.html">buy jordans 20</a></b> punish <b><a href="http://www.usretrojordans.com/air-jordan-shoes-1-C1.html">air jordan 1 sale</a></b> travel  market in Yunnan .

Comment

  1.    
     
     
      
       

Why Give Our Secrets Away?

I often get asked why I'm willing to journal all of my Sitefinity discoveries. People think I'm insane to give away for free what I labored over at some point.

Let me answer that in 2 parts:

  • Why journal my discoveries?

    Because I forget and I want to a library of knowledge to refer back to. Oh but it is far worse than that... THREE TIMES now, I've gone to Google and searched for a solution to a problem, only to find MY OWN BLOG entry is #1 in Google and viola! there's the solution!
  • Why give it away for free?

    Because others have been kind enough to do it for us; what goes around, comes around.

    There are all levels of experience, thus someone with less experience may defer to us when needed.

    The lines of 'competition' are very much blurred; in our minds competition is a potential customer or partnership in the right situation.

    We maintain healthy partnerships with one of our competitors; they come to us when they need help and visa versa.

    There is plenty of work out there for everyone if you are putting out quality work and you are straightforward with clients and competition.

Talk to us about how we can help YOU!

 


Don't miss out!

Keep up with our Sitefinity discoveries!
Click on the RSS feed icon below or sign up for our newsletter.


Email Address:
     















Company Info  |   Contact Us  |   Site Map  |   Terms  |   Privacy Policy  |  

Automated Results Computer Consulting LLC, 222 South Caldwell Street, Brevard, NC 28712 (828) 862-6667