I use the FlickrNet C # library, which still proves a massive hit.
However, I have one problem. I can get all the photos for the user ID, but I canβt get the given name to which the particular photo belongs without making another api call. This separate call gives me serious performance issues. It takes 30 seconds to load 40 images on the main page. It will only increase.
I need to get the set name for each photo, since I use an isotope to display images.
I just grab the images from the api and bind them to the repeater.
Here is my code.
WITH#
Flickr f = FlickrManager.GetAuthInstance(); protected void Page_Load(object sender, EventArgs e) { string userID = f.PeopleFindByEmail(" me@yahoo.com ").UserId; PhotoSearchOptions options = new PhotoSearchOptions { UserId = userID, Extras = PhotoSearchExtras.AllUrls | PhotoSearchExtras.Description | PhotoSearchExtras.Tags, SortOrder = PhotoSearchSortOrder.Relevance, }; var photos = f.PhotosSearch(options); rptPhotos.DataSource = photos; rptPhotos.DataBind(); } protected string GetSetNameForImageID(string imageID) { var sets = f.PhotosGetAllContexts(imageID).Sets; return sets[0].Title.ToLower().Replace(" ", "-"); }
HTML
<asp:Repeater runat="server" ID="rptPhotos"> <ItemTemplate> <section class="<%# GetSetNameForImageID( Convert.ToString( Eval("PhotoID") ) ) %> item"> <%--<a href="@Url.Action("Image", "Home", new {id = item.PhotoId})">--%> <a href="/View.aspx?pid=<%# DataBinder.Eval(Container.DataItem, "PhotoID") %>"> <div> <div class="item_hover"> <header> <span>D</span> <%--<p title="@item.Description" class="tiptip">_</p> --%> <p title="<%# DataBinder.Eval(Container.DataItem, "Description") %>" class="tiptip">_</p> <hgroup> <%--<h2>@item.Title</h2> <h3>@item.Tags[0]</h3>--%> <h2><%# DataBinder.Eval(Container.DataItem, "Title") %></h2> <h3><%# DataBinder.Eval(Container.DataItem, "Tags[0]") %></h3> </hgroup> </header> </div> <%--<img src="@item.Small320Url" alt="Video sit amet consectetur" />--%> <img src="<%# DataBinder.Eval(Container.DataItem, "Small320Url") %>" alt="Video sit amet consectetur" /> </div> </a> </section> </ItemTemplate> </asp:Repeater>
Is there a faster way to get the set name for each image without GetSetNameForImageID and then calling api?
source share