Daniel Reed
.NET, SharePoint and Graphic Design
Posted by mirata on Jul 19, 2011 in Download, SharePoint | 115 Comments

Download Mirata.PictureGallery.wsp (103kb)
Download Mirata.PictureGallery-source.zip (422kb)

Update: I have released a new version above. It incorporates a number of fixes including:

  • Locating Picture Libraries on SharePoint installations where the language is not English. Thanks to a number of users such as Serdar Ozcan for helping me identify this.
  • A property which allows you to disable JQuery. This is useful for people who have custom Master Pages and already register JQuery.
  • Some style fixes

During a number of my client projects, people have mentioned their lack of satisfaction with the out-of-the-box Picture Library list views. They give you basic thumbnail and filmstrip views, but they aren’t exactly the nicest or most intuitive designs out there. What people really want to do is quickly navigate and cycle through images efficiently. SharePoint’s Picture Library UI makes that somewhat difficult for a couple of reasons:
  • It takes a number of mouse clicks to get to actual image details, and this requires a full page postbacks. Navigating to a different image requires returning to the gallery and repeating the process
  • Folders give you no indication of what is inside, and once you’re in there, it’s hard to visualise the way back
  • There is no lighbox-type display available

This prompted me to write a web part to make better use of Picture Libraries, which I have provided on here for free.

There are a number of good lightbox clones out there, but i decided to use FancyBox for image display to its lightweight interface and really nice animations. I use FancyBox in my gallery section of the site, so if you want a good idea of how this component works, check the gallery out.

The web part displays the pictures in a grid in a fairly similar fashion to the default SharePoint one. The grid reorders itself depending on window size. Folder thumbnails look much nicer than generic SharePoint ones, and actually show you some of the images stored within.

So dow did I do this? A breakdown of some key components are listed below.


The way in which the web part operates is fairly optimised. For a start, it uses paging, and in SharePoint this is unnecessarily complex. With SharePoint pages, you always need to pass the SPListItemCollectionPosition to the next query in order to get the next page. I’m sure there’s a good SQL reason behind this, but it makes it notoriously difficult to say something like ‘get me the 5th page’ because you have to get the preceeding pages first. Secondly, you can’t change sorting or filtering midway, because this will mean you have to start again.
private SPListItemCollection GetListPage(SPList list, SPFolder folder, ref string listItemCollectionPosition, uint pageSize)
    SPQuery query = new SPQuery();

    query.Folder = folder;
    query.RowLimit = pageSize;
    if (!string.IsNullOrEmpty(listItemCollectionPosition))
        query.ListItemCollectionPosition = new SPListItemCollectionPosition(listItemCollectionPosition);

    SPListItemCollection items = list.GetItems(query);
    if (items.ListItemCollectionPosition != null)
        listItemCollectionPosition = items.ListItemCollectionPosition.PagingInfo;
        listItemCollectionPosition = null;
    return items;


The web part uses thumbnails for both the folders and individual images. This is important to minimise the amount of data download at any given time. A SharePoint picture library stores both a web image and a thumbnail image whenever you upload a picture. The code to retrieve all 3 images is below.
string thumbnail = new Uri((string)item["EncodedAbsThumbnailUrl"]).AbsolutePath;
string webImage = new Uri((string)item["EncodedAbsWebImgUrl"]).AbsolutePath;
string fullImage = new Uri((string)item["EncodedAbsUrl"]).AbsolutePath;
For a folder, I retrieve the 3 most recent image thumbnails. If they do not exist, I choose from a couple of hard-coded provided images. This way, the folders always look nice. I stack the 3 thumbnails together with css, positioning them slightly differently to each other.

Image Size

As mentioned, webpart uses the thumbnail to display small image previews. When you actually click on an image to launch the lightbox, it uses the Web Image. This is a stored version of the image optimised for a web browser. Every Picture Library’s thumbnail and web image size can be individually customised through either the API or a feature. I have provided a small option to modify this value for whatever picture library you are working on, but it is worth noting that doing this will change the default value, and it will also do it for any images added after changing the setting. I have not attempted to do any retroactive modification of web images.

SPPictureLibrary library = (SPPictureLibrary)web.Lists[listName];
if (library.WebImageHeight != webImageSize)
    library.WebImageWidth = webImageSize;
    library.WebImageHeight = webImageSize;

So in short, if you want your images to display larger in the lightbox, configure this setting in my web part properties before putting images in, or consider writing some powershell to update existing images.


If you edit the web part, there is a custom toolpart to specify the list. The web part picks the current site by default, but allows you to specify any site or web assuming you have access.
A couple of properties you can set are:
  • Fancybox fade in and out animation eg: elastic, fade or none
  • Fancybox text position eg: inside, outside or over
  • Number of items per page
  • Image size – this property changes the Web Image size mentioned earlier


The solution is a Site Feature, so simply install the wsp to your farm using PowerShell. You can then activate the Mirata Picture Gallery on your site collections.

Final Notes

There are a lot of areas in which this web part can be improved. But you have to stop working on it some time. Using AJAX for paging would be nice. This would require triggering FancyBox initialisation each time a page set came back which shouldn’t be a big deal. Navigation into folders and back out of them could be improved too.

Now I will admit, I have not thoroughly tested this for all sorts of security conditions. The webpart uses elevated privileges so anyone viewing the webpart will at least get links to pictures, but if items are not published, the links may indeed be broken. It’s not due to lack of programming skill – its down to lack of caring :)

As always, this should be pretty stable, but don’t hold me accountable if your SharePoint farm spontaneously develops a sentience and starts singing Maria Carey songs or anything. But I am keen to hear back from anyone who uses it! And if you want any improvements or modifications, let me know and I will consider them. I may also release the source code.

  • Hi Daniel,

    Your webpart is by far the best sharepoint image gallery I have come across on the web. It does generate some errors on our custom master page however. (it works, but pictures cannot be opened in a lightbox). We are allready using jquery for the masterpage, and i notice that on page rendering he executes both your jquery .min file and ours (which is also more recent). If i remove our jquery reference the problem with your webpart is solved (but then of course our masterpage acts weird).

    What I hope is that if we remove the line that calls your jquery file, everything should work as expected. Is it possible to give us a look at the source code, or a copy of your .wsp without the jquery .min file reference? This would be greatly appreciated.


    Kristof Van Casteren
    SharePoint consultant

    • Hi Kristof,

      Glad you like the web part. I will be happy to help out. From previous experience I know that lightbox plugins generally have issues with jquery versions.

      Can you do me a favour first.. Try renaming or deleting my jquery file in the 14 hive and see how it behaves. If this fixes your issues, I will add a appSetting option to not include jquery. If it does not fix your issues, I will make a few more changes to ensure it does work for you.

      Best regards,

  • Hi Dan,

    I did what you asked, and indeed it didn’t do the trick.
    But we worked around the issue by changing our masterpage so it doesn’t need jquery anymore. Now everything runs smoothly. As long as the jquery library is not referenced anywhere else on the page, your webpart runs fine.

    Thanks again for your help,


  • Hi,
    i see that the picture gallery manages photo albums (Art, Wallpaper…). How can i enable this feature?



    • The installation instructions above should point you in the right direction. Let me know if you get stuck along the way and I’ll try to help out.

      • Ji I have instaled the webpart (its excelelnt for what we want), but i have a slight error. imsure its user error but i have several folders in my gallery, 2 display fine then i have the following error…”An error occured while displaying the gallery: Value does not fall within the expected range. ”

        Any ideas of what i have done wrong?

        ps. willing to pay for support :)

  • Hi Dan,

    Your web part is really great. You’ve done a great job.
    I deployed it and I can add it to my site. But it does not enumerate the picture gallery list
    to the dropdown list on the options panel. I tried with several site urls, but no galleries on the list. It just says “[Select]“. Despite of there are 4 or 5 picture galleries on the site.
    Could it be a language specific problem?The server is SharePoint 2010 but it is not the english version.
    Or any other ideas?


    • Hi Andras. Hard to know the specific problem without knowing some more details. However, the dropdown list is currently limited to lists that inherit from the Picture Library content type. So firstly, make sure your list is a Picture Library. I haven’t tried with custom content types.

      I could also try disabling the content type filter on the dropdown to see if your list is supported.

      • Hi Dan,

        I just mistyped. Of course it’s a picture library. A simple, standard picture library. I know that is the list type what I need. So, I don’t use any uncommon list types.
        There is also one picture library list on the site where the web part added, but I cannot see neither that one or if I specify another site’s picture library. :(


        • Hi Andras,

          If you have a developer background, you can now download the source. That might help you identify the problem. If you end up locating it and find a bug, I would appreciate if you let me know so I can improve the code! All the best.

  • Hi,
    Really nice, clean and professional! I installed it and works perfect. Do you think there are any chances for you to release the source code? I will want to customize it a bit to suits our needs …

    Thanks a lot in advance!
    - Lazar

    • A few people have made that request recently. The source is now available for all. If you do anything cool with it, I’d be keen to see the results.

  • Hey,
    i got the same problem as Andreas. I don’t see any picture libary in the dropdown list.
    I use https, could that be the problem?

    • Could be.. I did release an updated web part that should solve that issue, so try it out and let me know how you get on. If it still fails I will try to get to the bottom of it.

  • Is this compatible with SharePoint 2007?

    • No, only 2010 I’m afraid.

  • HI

    Excellent web part, but its only showing 16 images / folders, when in my picture gallery it has alot more.

    but when going to the settings and increasing that, nothing changes,

    anyway i can change it to view the hole gallery.

    thanks in advance.


    • The Web Part settings include a Page Size option which allow you to choose the number of items you see on one page. In any case, you should also see a Next and Previous option which allow you to navigate to the other pages.

      • Hi

        as before, ive change the settings for how many it holds, but still doesnt bring though all the images one of the folders has about 400 images and when you go to the webpart it only holds 10?

        any ideas?


  • Hi Dan,
    Actually, the UI looks weird on IE 7. Any idea how to fix the stylesheet to support IE 7 ? thanks.

    • Can you be more specific? I know ie7 does have some particular issues with centering and scaling the images, and that makes the presentation not as good as ie8+. I didn’t spend a huge amount of time making it compatible with ie7 – just enough to render ok.

      If you can email me a screenshot of your issue, u may be able to address it.

  • hi,

    first of all, i must say thanks for this brilliant webpart….

    this is the best picture gallery webpart i found so far….

    i modify the code to use fancy box v2 and integrate

    comment box webpart by Alexander Bautz (http://sharepointjavascript.wordpress.com/2011/07/11/commentbox-for-sharepoint/)

    into this picture gallery…. the result is….. Facebook Picture Gallery… lol…

    thanksss….. :)

  • We installed the WSP file using SharePoint management console and deployed it to our farm. How do we go about using this feature? Should it appear as a web part?

    • Once deployed to the farm you need to activate the feature under Site Collection Features. then you should see the web part under the list.

    • We failed to activate the WSP after deploying. Have it working now. This is a great feature to have for SharePoint, especially since the OOTB solution for thumbnails is spotty in browsers other than IE.

  • Very nice job and, really, just in time for a project I need to roll out quickly! I hope you have time for a quick reply.. I’m wondering about two things: The preview size for the thumbs is indicated in the “image size” value, correct? I have imported the images and that field defaulted to “640.” I’m wondering what format is expected for a new size? Say, 400px by 600px? Also, is there any way to add comments or other code BELOW the thumbnail (unique to every image)?

    thanks again!

    • Hi Michael. I think the image size field you refer to is actually the size of the medium preview. When you add an image to SharePoint, it creates a small thumbnail and a screen-size preview.. That way if you upload a massive image, you don’t need to download that in typical list views. If I remember correctly, my field is for that image, not the actual thumbnail.

      If you change that value, SharePoint all use that number to scale pictures added accordingly. But only new pictures! It doesn’t resize ones you have already added, so be aware of that. You might need to export your pics, change the value and re-add.

      As far as comments below the thumbnail, I think I may have only done the title. I contemplated allowing the user to supply some sort of template HTML, but I didn’t follow through on that. The source code is available if you want to tweak the code for your own use. Hope that helps you out.

  • Hi Dan, this web part is excellent…
    I add some lines of code, so people can rate the pictures…
    and.. still searching improvement so people can give a comment..

    by the way, thanks…

    • Hi, Orakle! Please tell me, how to change the code to people can rate the pictures?

  • Hi – We really like your web part but when we use it, the theme and layout of the page seems to break (changes the banner, color scheme, etc..). Any idea what could be causing this? Thanks!

  • Hi, first off thank you for creating this webpart and releasing the source code. I have installed the webpart and have pointed it to my picture library, however it is showing only a single sub-folder from my picture library. Beside that folder it shows the error “An error occured while displaying the gallery: Value does not fall within the expected range.” Do you know what the cause of the error could be? I plan to spend a few hours over this weekend modifying the source code to better match my requirements. If I am able to find a solution I will post my modifications. Thanks!

    • Well I have finally had time to look through the code and find the cause of the error I was having. The error was occurring within the RenderFolder function. It appears that in my environment at least that the SPListItem item that is passed to the RenderFolder function does not have the title attribute set. I know that this is probably because my subfolder items do not have a title attribute set to begin with. So I added a check if the item.Title is null then use the item.DisplayName attribute instead, which every item has. What is odd is that the first “item” does have the title attribute set and that is why the first folder would load. However, all subsequent “item” do not have the title attribute set so I changed this to use DisplayName.

      I also had to modify the RenderPicture function since the title of the picture was not showing underneath the thumbnails. My photos within the album do not have a title set for every single image, and I cannot set a title for all of them since I have over 1000 images. So I added a check if the item.Title is null then use item.DisplayName instead.

      I plan to work on this web part more in my free time to improve the pagination handling for a large amount of sub folders within a picture library.

      Thanks again for the great web part and for releasing your source code. This is by far the best free picture gallery out there for SharePoint.

      • Great web part Dan!
        @ lmanders, could you please help me with your modification. I will be glad to get your modified .wsp file. Thanks

  • Let me start by saying thank you for creating such a wonderful webpart. With that said, I’m running into a small issue and not sure if I’ve just done something stupid or not. It would seem that anytime you click on Next Page it always gives a There are no images to show in this folder. message. I can keep increasing the number of pictures to show to get them all on the page, but would much rather not display 100s of pictures at once.

    Any thoughts on what could be causing this?

    Again, thank you for all your hard work.

    • I am having the same problem. I have an album with 100 pictures. I have set each page to show 25. The 1st page of 25 shows fine, but when I click Next Page, it says “There are no images to show in this folder”.

      Thanks you for this great webpart.

    • Hello Stephen,

      I have been modifying this web part quite a bit recently to accommodate my needs. I also come across the issue where clicking Next Page always gives There are no images to show in this folder. There is a small error in the source code of the web part. If you have access to Visual Studio you can make the modifications to the web part and deploy it to your site for testing.

      What fixed the pagination for me was commenting out lines 43 and 44 of PictureGalleryWebPartUserControl.ascx.cs:

      string folderUrl = Page.Request.Params["folder"];
      CurrentFolder.Value = folderUrl;

      This file is in Mirata.PictureGallery/PictureGalleryWebPart

      I then deployed the web part using Visual Studio and all was well. Hope this helps!

  • Hi Dan. Here is some kind of bug in your web part. It works great if there are no any folders in Photo Library, otherwise it shows the error : “Invalid URI: The format of the URI could not be determined.”
    Or maybe this is not a bug at all, and I should do smth with it?


  • Hello, Daniel!
    Thanks for that solution, the way it works is very cool.
    However, i’ve got a problem with displaying folders from the library. When the picture library contains folders, the Web Part returns an error: “An error occured while displaying the gallery: illegal URI: Can’t determine URI format.” (i’ve translated it into english by myself, so the text could be not the same exactly).
    And without any folders it works perfectly! The name of the folder doesn’t matter.
    Hope you could advice something to understand the reasons.

    Kind regards,

  • Hi,

    I am playing around with this nice webpart (and thanks providing such a solution), but couldn’t figure out how this folder view (as shown in the image above) works. Inside my image library are different folders with images, but how do I get the preview “image” for the folders?

    As far as I understand the option “Starting Folder” can be used to set the startpoint for the webpart.
    Once I set this to be empty and subfolders with images are present, the following error is displayed:
    “An error occured while displaying the gallery: Ungültiger URI: Das URI-Format konnte nicht bestimmt werden. ”

    –> any ideas?


  • An error occured while displaying the gallery: Value does not fall within the expected range. I get this when I try to get the folder structure to work. Any ideas?

  • I could not even set up webpart, i get “An error occured while displaying the gallery: List ” does not exist at site with URL …” error. I have empty space site text field, and empty drop box for lists.
    Is there anybody who would recompile webpart package and send me for a try?

  • Hi

    For me it also works fine until language is set to “English”. If i change it, i’ll get same “Invalid URI: The format of the URI could not be determined.” error message.
    Any ideas how to fix it?


  • Hi Daniel, great web part!!! thank you very much. Just a quick suggestion.. is possible to check if an item content type is equal to folder without having a culture issue? I mean, in spanish for example, the line ( item.ContentType.Name == “Folder” ) chash! because SharePoint is installed in Spanish, so, the line should be (item.ContentType.Name == “Carpeta”).
    I fix it on my code but it would be great if code could do it automatically. May be something like item.ContentType.Parent.id =”1×0120″

    Best regards,

    • HI Elio, thanks for the compliments and feedback. The wsp and source have been updated for you.

  • Great work!
    Problem: our SP2010 site is in English (1033) and in Estonian (1061) language. Webpart works excellent, when language is set to English. When Estonian language is selected, gallery gives following error :

    An error occured while displaying the gallery: System.UriFormatException: Invalid URI: The format of the URI could not be determined. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at Mirata.PictureGallery.PictureGalleryWebPart.PictureGalleryWebPartUserControl.RenderPicture(SPListItem item) at Mirata.PictureGallery.PictureGalleryWebPart.PictureGalleryWebPartUserControl.RenderPage(SPFolder folder, SPListItemCollection items, SPFolder baseFolder) at Mirata.PictureGallery.PictureGalleryWebPart.PictureGalleryWebPartUserControl.c__DisplayClass1.b__0()

    Can you tell me, what’s wrong and how to fix it?

    • Hmm. Not very easy to identify. I have made a change to the WSP. See if it fixes your problem – but I suspect it wont, since its a different line number.

      If anyone out there is able to debug a SharePoint instance in another language, it would help me out! Most ofthe problems seem to be related to things I can’t test without enabling other languages.

      • Dan, I owe you a beer…. Incorrect… I owe you many-many beers!
        It works like charm.
        Thank You


        • One more question:
          In test environment, everything is perfect. In live environment, for some weird reason, Mirata can’t show those 3 image thumbnails. Thumbnails are created and accessible, for example, i can see
          http://my site]/Gallery/Test/_t/Jellyfish_jpg.jpg from browser.

          What’s wrong?

  • Hi Dan,

    Thank you for this gorgeous gallery! I would be very interested in being able to filter based on user input (like filter webpart connecting to List View). I am searching high and low for a thumbnail gallery solution with filter options. The solutions either only work on a picture library which doesn’t allow connections, or List Views which will not render in thumbnails such as yours.

    Thanks in advance for any direction…

    • Thanks. I did consider doing that, but laziness got the better of me. I may look at it. Also, there is a newer, better version of fancybox out and I may adapt that at the same time.

  • Hi,

    I must say,it’s a very great pic library I ever seen.It works fine,but I wanted to create the descending order of library(by “Created”). I tried by doing ascending-false into source code but it didn’t work.
    Can u suggest me,how can i achieve this??


  • Hey Mirata,

    The latest folder fix for spanish folders broke something else…

    when a folder gets created using the window explorer view “action -> Open with Windows Exploerer” we get the error “An error occured while displaying the gallery: Value does not fall within the expected range.”

    • As a follow up to my previous comment

      Problem is the “RenderFolder Function

      Folder that get uploaded via “Explorere view” do not have a “Title” so that causes an exception

      Modified the Folder function to use the “Name” in case Title is blank

      private void RenderFolder(SPFolder folder, SPListItem item, SPFolder baseFolder)
      SPList list = item.ParentList;
      string FolderName = “”; ///Added the Folder Name String Variable

      ///check if we have a tile, if not, use the item (folder) name
      if (item.Title == “”)
      FolderName = item.Title;
      folder = folder.SubFolders[FolderName];

      Also, Modified RenderPicture for the same thing, check if Title is blank

      private void RenderPicture(SPListItem item)
      string thumbnail = new Uri((string)item["EncodedAbsThumbnailUrl"]).AbsolutePath;
      string webImage = new Uri((string)item["EncodedAbsWebImgUrl"]).AbsolutePath;
      string url = new Uri((string)item["EncodedAbsUrl"]).AbsolutePath;
      string description = (string)item["Description"];

      string imageName = “”;

      if (item.Title == “”)
      imageName = item.Name;
      imageName = item.Title;

      Literal lt = new Literal();
      lt.Text = string.Format(@”

      “, thumbnail, description, webImage, imageName);


      Lastly, Modified RenderPage so when it checks to compare the item.ContentType.Parent.ID.ToString, the ContentType from “FolderContentType” is also a string

      private void RenderPage(SPFolder folder, SPListItemCollection items, SPFolder baseFolder)
      foreach (SPListItem item in items)
      if (item.ContentType.Parent.Id.ToString() == FolderContentType.ToString() )
      RenderFolder(folder, item, baseFolder);



  • Hi Sir,

    I cannot add up the webpart after installing the feature. It has a popup message of “A Web Part or Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe.” What will be the solution for this error?

  • Ok, Sorry, I added MORE error checking to “RenderPicture”

    If there is a file, lets say a thumbs.db in there, it will crash, this handles that

    private void RenderPicture(SPListItem item)
    string thumbnail = null;
    string webImage = null;

    string imageName = “”;

    if (item.Title == “”)
    imageName = item.Name;
    imageName = item.Title;

    thumbnail = new Uri((string)item["EncodedAbsThumbnailUrl"]).AbsolutePath;
    webImage = new Uri((string)item["EncodedAbsWebImgUrl"]).AbsolutePath;
    catch (Exception)
    thumbnail = “/_layouts/images/Mirata.PictureGallery/folder_thumbnail1.jpg”;
    webImage = “”;
    imageName = “#Invalid Image File#”;

    string url = new Uri((string)item["EncodedAbsUrl"]).AbsolutePath;
    string description = (string)item["Description"];

    Literal lt = new Literal();
    lt.Text = string.Format(@”

    “, thumbnail, description, webImage, imageName);


  • i am getting access denied error while editing the webpart
    please help me ……

  • really nice webpart!!! after lots of hours looking up for a gallery …. your webpart its amazing!

  • I made a slew of bug fixes, paging fixes, and navigation fixes (including adding sorting, etc)

    I’m just going to post it to my site (the one attached to this comment)

    as always, i will make sure i credit you as the creator

    • where can I find the corrected version of web part?

    • Where can i find your corrected version of this web part?

      • Its already linked at the top of the page.

  • You’ve done a great job. but I find it unfortunate that cannot connect this webpart with another :(

  • Dear Daniel Reed …
    i have facing a problem with your webpart , when i create a sub folder and upload images it doesn’t work .

    thanks and advance

  • I want to show its thumbnails…

    Please help me???

  • Hi -
    I uploaded your soultion but I am unable to activate it? I used system account.
    The activate button comes up grey.

    thanks in advance..

  • Hello! Very nice product! But, how fix problems with blank page when set “Page Size” ? Only first page display pics, next page say “There are no images to show in this folder”. ???

    No Visual Studio )))

    May i download someone “fixed” wsp ?


  • Very interested in using your picture gallery webpart but unable to download the wsp file. Is there a new link somewhere to download?

  • Thank you for this gorgeous gallery!
    how to show its filmstrip on bottom, can any one help

    thanks in advance.

  • Hello,

    The solution looks perfect for what I am trying to achieve. But I am unable to download WSP as it says that the “Service is unavailable”. Do you know when it will be available or if you can tell me some other way to download it.


  • Please tell me, how to change the code so that people can rate the pictures?

  • Hi Mirata,

    Please reply a solution for following requirement :

    1. Employee upload the picture
    2. After upload picture mail go to jury
    3. Jury to decide on photographs to be published
    4. like option to be tagged with each photograph and each employee will have the option of liking a photograph only once with comments.

    Note : Similar to facebook. Please help Sir.

  • Daniel – two words: Thank You!


  • Hey would you mind stating which blog platform you’re using? I’m going to start my own blog soon but I’m having a tough time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something completely unique.
    P.S Apologies for being off-topic but I had to ask!

    • Hi, I use WordPress, but because I like to hack around, I made my own theme.

  • Can I have complete working demo of your WebPart ?

  • Hey Daniel & Co..
    I have to agree on everyone else in this thread, amazing webpart and soo much better than the OOB Picture Library that SP provides. This worked perfectly on my dev environment, however, when deploying to my Prod environment, the picture gallery works ok, but when clicking on the picture itself it doesn’t pop-up and use the nice fade in functions. It just seems to use go to another page and display the image only.
    Has anyone else experienced this problem? Perhaps its not referencing the JQuery library properly? Much appreciated for anyone’s help on this.


  • Hi..
    Realy great and awesome webpart u have developed.
    I am amazed with the look and feel.
    But i would like to know wther you have code which can be included in a sanboxed application? Thanks

  • Hi Daniel,

    I’m not a developer, just a business user with our organization. Just looking into whether I should ask our IT guys to install this for a new project we’re working on.

    I’m curious as to whether the web part allows the user to view/edit additional columns that are added to the list? We’re building a photo repository to facilitate the publications and websites we develop, so we need to manage key metadata such as the dates a photo is used in publication, defined keywords, who owns the photo, references to signed consent forms (in a document library), etc.

    If anyone who is currently using the web part can answer, please do!

    Many thanks.

    • This web part doesn’t have a whole lot of customisation features in it to be honest. In future versions I may do this. Any additions would need a programmer to modify my source.

  • Great work on this webpart, awesome way to display pictures on a sharepoint site.

  • I am posting this in the event someone else has the same issue.

    We were getting an error with some libraries that said “Value outside expected range”. Turns out sometimes the folders had an empty title field. No idea why and if I copied the same library to a test library it would fail differently. If you go into the function “Render Folder” and just put a try catch around the line “folder = folder.SubFolder[item.Title];” and then in the catch try item.Name instead, it fixed the issue for us. Not my favorite solution but I’d be checking individually if I want to check another potential identifier.

    We do not know of the cause.

    • Thanks for posting that. I appreciate it when people contribute back.

  • Hi Daniel,

    Very good job, it´s function very well for me, but I want to make one thing more that I don´t understand how do. I read all page, but I didn´t find the solution.
    I have some folders, and the folders has some pictures, ok ?
    I wanna put the sample pictures in each folder, like a cover photos for each folder.
    I saw that is possible, but I don´t know how.
    PS: I´m not a programmer, and if I need to alter some files and recompile the mirata addon in sharepoint, I need to some help to do this too.

    Thanks a lot,

    Leandro Braga

    • If I understand your requirements correctly, this is different to what my web part does. Mine takes 3 images and its always the latest 3 – not a specific cover photo. Unfortunately achieving what you want involves code, and if you aren’t a programmer you would need someone to modify my source code for you.

  • Hey Dan, fellow aussie here.. Would appreciate if you could respond to a minor question I have in reference to the web part. Trying to work out how to modify the view in the web part to display the most current folder added to be the first? Currently the last picture library I add, goes to the bottom of the list. Gone through the web part options and cant find anything? Is there a way to do it?

    Cheers bud

    • Hi Sanchez, sorry for the late reply. I’m afraid it doesn’t work off a view and as such you probably can’t tweak the ordering. It would require code changes. Ideally the next version I do will work off a view so you can customise just about everything

  • Hi I would like to know if this webpart takes filter values from other webparts.

    • Unfortunately no.

  • Hello. I really liked your web part. Is it possible to change the tile size for the gallery? I want to use this web part to display a bunch of similar sized photos without leaving gray areas around the image.

    • I haven’t left many customising options in this control. NOte that if I ever get fre time, I intend to rewrite this web part and do a lot more cool things. In the meantime you would want to edit the css file. I don’t know if you’re a technical person, but it gets deployed to the 14 hive and you could change pretty much every style element in there.

  • There are some 30 to 40 folders in my picture library where i want to show all pictures in the thumbnail view but unable to find option to show all pictures..when edited webpart i am able to mention only one folder name which shows pictures placed in that folder but my requirement is to show all pictures in all folders at one instance..is it possible??

  • Hi, it’s great! How to sort pictures from newest to oldest?

  • Hi Mirata, great webpart. i have a question… i deployed and all function ok.. but in the image folder. the thumbnails show de default images…. but dont show the image that are contain inside the folder..
    i need to create a special view? thanks.

  • If anyone is interested in gallery ordering, it is fairly easy to modify from the source. Open the project in VS and around line 297 of PictureGalleryWebPartUserControl.ascx.cs after SPQuery is instantiated , add this line:

    query.Query = “”;

    This will order the gallery by created date descending.

    Hope this helps.

    • I followed the steps provided by you but still the folders are not sorted by created date. Can you please help me with this..

  • I really like this webpart ! it does everything i need.

    just one question: Why does it screw up my own sharepoint design ? it looks like it falls back to the default design.

  • Hello. I’m trying to deploy the wsp to a public SharePoint Online site. But this result in the following error: The element ‘Solution’ in namespace ‘http://schemas.microsoft.com/sharepoint/‘ has invalid child element ‘TemplateFiles’ in namespace ‘http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: ‘FeatureManifests, ActivationDependencies’ in namespace ‘http://schemas.microsoft.com/sharepoint/'.
    Can you help me out on this one?

  • I have added an extra line of code into the solution of Ruben where he is using the filename when the title of the image is not available.

    This extra line of code will remove the file extension from the filename

    private void RenderPicture(SPListItem item)
    string thumbnail = new Uri((string)item["EncodedAbsThumbnailUrl"]).AbsolutePath;
    string webImage = new Uri((string)item["EncodedAbsWebImgUrl"]).AbsolutePath;
    string url = new Uri((string)item["EncodedAbsUrl"]).AbsolutePath;
    string description = (string)item["Description"];

    string imageName = “”;

    if (item.Title == “”)
    imageName = item.Name;
    imageName = imageName.Remove(imageName.IndexOf(“.”)); ///Removes file extensions
    imageName = item.Title;

    Literal lt = new Literal();

  • Hi Ireally like your web part but when we use it in 2010, the theme and layout of the page seems to break (changes the banner, color scheme, etc..).they are custom page layouts. Any idea what could be causing this? Thanks!

  • Hi, i want to change the image in the homepage as per location. Lets say, i am having 5 locations and each location is having n number of users, when a user log in to the portal, the image in the homepage should change as per the location the user belongs to. Please advise me the solution.

    Thanks in advance.

  • Awesome work! Would you please advise how to add a button for custom sorting (sort by filename, modified date)? I have tried to add a button and it only works at the current page but it doesnt work when clicking previous/next page button. The ordering remains the same.

  • Hi Daniel!

    Thank You very much for Your Mirata!

    Can You explain please about thumbnail for folder? My Image library contains only ‘EncodedAbsUrl’ field. Did You mean that I need to crate other two fields – “EncodedAbsThumbnailUrl” and “EncodedAbsWebImgUrl”. What types they shoul be, calculated?

  • Ok resolved! :)
    Fields already exist, but are not shown..

    In my case there is russian distributive, got an exception in this part of code:
    int width = (int)results[i]["Picture Width"];
    becouse in russian edition there is no field “Picture Width”. Changing to
    int width = (int)results[i]["ImageWidth"];

    Thank twice for great webpart! :)

  • Hi Daniel,
    I’m trying to load you app to our Intranet site.We are using SharePoint 2013 online (Office365).

    I get the following after uploading the solution and clicking activate:

    Sorry, something went wrong
    This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution ’90b79828-a2b1-4b7e-9c67-6c24d3a9339d’ failed validation, file manifest.xml, line 10, character 4: The element ‘Solution’ in namespace ‘http://schemas.microsoft.com/sharepoint/‘ has invalid child element ‘TemplateFiles’ in namespace ‘http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: ‘FeatureManifests, ActivationDependencies’ in namespace ‘http://schemas.microsoft.com/sharepoint/'.

    Technical Details
    Troubleshoot issues with Microsoft SharePoint Foundation.
    Correlation ID: 25504b9c-8a1e-70ea-f806-4adda38ac358
    Date and Time: 10/10/2013 7:46:41 AM

    Any ideas?

    • Yes, plenty. This won’t work with SharePoint Online unfortunately. Although the error is ugly, it is quite descriptive. The code I am using requires a Farm Solution and not a Sandboxed solution. SharePoint Online is Sandbox only, so it won’t work. In the next version I release, I will try to make it support the sandbox for you.

  • Hi mirata

    Are there any reports of this working with Sharepoint 2013 Foundation?


    • Er, I have no idea. There’s nothing specific about the code that makes it work with Standard and Enterprise only (to my knowledge). Feel free to try it and let me know.

  • Thank you thank you thank you thank you!!!! A day of searching for some way to get SP2010 image gallery to do what I want it to do and all of a sudden I hit on your site. This is a diamond in the rough webpart. You need to get it to the top of the Google searches and in CodePlex. More people could use this and it would save them a lot of hair pulling.

    • Thanks, I appreciate it. I am seriously considering rewriting this, so maybe I’ll put it up on CodePlex. Then I’ll rely on everyone else to bump its popularity.

  • hi i have used this gallery to my share point web. so now i want to change folder default three thumbnail. so can i do it without redeploy the solution. can you some one help me to do that because am in big trouble.

    thank you

    • You can do it without redeploying, but it is a bit of a hack. You can go to the SharePoint 14 hive and locate the images under images/Mirata.PictureGallery. There are 3 default images, and you can replace them. Tada

  • Hi! Mirata

    I have the same issue as Marco. The page where I have added the webpart seems to reset to the default v4.master core.css

    I have unchecked the register jQuery from the webpart configurations but still it resets the masterpage css to the Core4.css

  • You are awesome! Thank you very much!

  • Please.

    Can you repost the wsp with the images displating by Created DESC as opposed to Created ASC? AND/OR can you have a toggle option that does this in the web part properties?

    I tried the edit metioned above to do this but it did not work for me. … query.Query = “”;

  • Hi Mirata

    A bit new to Sharepoint. I am using Sharepoint 2010 Foundation. I have deployed the .wsp via command prompt and the application shows up in “Central Administration : Solution Management”. I have then deployed it to the the intranet site. I am not sure what to do next. Should the gallery webpart show up in my list available web parts ?

Leave a comment to Gad

Spam Protection by WP-SpamFree