Friday, January 13, 2012

Sharepoint Picture library Thumbnail view problem with out writing any code

if you have thumbnail view problem in the picture library allitems.aspx page ..just make sure that below contentplaceholder is avilable in the master page. Thumbnail view will not work if it is commented out in the master page


       <asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/>


some times picture library thumbnail view wont work properly (for ex when you add it to site pages or any other pages). here is the small fix for this.

1) add content editor webpart to your page and select Content editor webpart the one you added and go to EditHtmlsource >  copy and paste below code.
2)that's it.. now you are good to go....

<TABLE style="padding-top: 8px" cellSpacing=0 cellPadding=0 border=0 width=100%>
<TR valign=top><TD>&nbsp;</TD></TR>
</TABLE>
<TABLE id=ImgPreviewTable cellSpacing=2 cellPadding=0 border=0 width=100% style="display:none">
<TR><TD vAlign=center >
<SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" text="<%$Resources:wss,piclib_picturePreview%>" EncodeMethod='HtmlEncode'/></TD></TR>
<TR><TD class="ms-navline" width=128><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></TD></TR>
<TR>
<TD vAlign=center align=center style="padding-top:3px" onClick="ClickPreview(); return false;">
<a name="lnkPreviewImg" id="lnkPreviewImg" href="Javascript:">
<img SRC="/_layouts/images/preview.jpg" NAME=ImgPreviewThumbnail ID=ImgPreviewThumbnail class=thumbnail height=90 width=120 alt="<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,piclib_picturePreview%>' EncodeMethod='HtmlEncode' __designer:Preview="Picture Preview"/>"></a><br>
<a name="lnkPreviewTitle" id="lnkPreviewTitle" href="Javascript:" class="ms-imglibPreviewTitle">"<SharePoint:EncodedLiteral ID="EncodedLiteral2" runat='server' text='<%$Resources:wss,piclib_pictureFileName%>' EncodeMethod='HtmlEncode'/>"</a>
</TD>
</TR>
</TABLE>



Adding above code to content editor webpart.


 When you have 2 picture libraries in the same page above code is not working. So please add one picture library and Asset library  then it works as shown in below picture.



3 comments:

  1. Surya, This code is really good and it solved my issue in Sharepoing picture gallery.

    Good work.. keep it up.

    ReplyDelete
  2. This code didnot work in my case. I added a Content editor webpart --> Modify Shared Webpart --> Source editor and pasted your code in there.But unfortunately it is not displaying any image as there are two pics in my picture library. Also one question arises is if theree are two or more than two picture libraries then how does it identify which one to pick out of the two ?

    Cheers,
    Amiya

    ReplyDelete
    Replies
    1. Amiya, I just tried above code and it is working fine when you have single pic lib in a page. If you have 2 libraries i would suggest you to go for pic lib and asset lib as shown in my blog (just updated.)

      Thanks,
      Surya.

      Delete

Followers