本文整理汇总了C#中FlickrNet.Flickr.PhotosGetInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Flickr.PhotosGetInfo方法的具体用法?C# Flickr.PhotosGetInfo怎么用?C# Flickr.PhotosGetInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlickrNet.Flickr
的用法示例。
在下文中一共展示了Flickr.PhotosGetInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOnePhotoInfoFromFlickr
public FlickrPhoto GetOnePhotoInfoFromFlickr(string photoId)
{
Flickr flickr = new Flickr(_apiKey, _secret);
flickr.InstanceCacheDisabled = true;
PhotoInfo photoInfo = new PhotoInfo();
FlickrPhoto flickrPhoto = new FlickrPhoto();
try
{
photoInfo = flickr.PhotosGetInfo(photoId);
flickrPhoto.PictureId = photoInfo.PhotoId;
flickrPhoto.OwnerName = !string.IsNullOrWhiteSpace(photoInfo.OwnerRealName) ? photoInfo.OwnerRealName : photoInfo.OwnerUserName;
flickrPhoto.Title = photoInfo.Title;
flickrPhoto.Description = photoInfo.Description;
flickrPhoto.AvailablePublic = photoInfo.IsPublic;
flickrPhoto.SmallImageUrl = photoInfo.Small320Url;
}
catch (Exception ex)
{
if (ex is PhotoNotFoundException)
{
flickrPhoto.AvailablePublic = false;
}
}
return flickrPhoto;
}
示例2: GetPhotoInfo
public static PhotoInfo GetPhotoInfo(string photoId)
{
Flickr flickr = new Flickr(ConfigurationManager.AppSettings["apiKey"],
ConfigurationManager.AppSettings["sharedSecret"]);
return flickr.PhotosGetInfo(photoId);
}
示例3: UploadPhoto
public IPhoto UploadPhoto(Stream stream, string filename, string title, string description, string tags)
{
using (MiniProfiler.Current.Step("FlickrPhotoRepository.UploadPhoto"))
{
Flickr fl = new Flickr();
string authToken = (ConfigurationManager.AppSettings["FlickrAuth"] ?? "").ToString();
if (string.IsNullOrEmpty(authToken))
throw new ApplicationException("Missing Flickr Authorization");
fl.AuthToken = authToken;
string photoID = fl.UploadPicture(stream, filename, title, description, tags, true, true, false,
ContentType.Photo, SafetyLevel.Safe, HiddenFromSearch.Visible);
var photo = fl.PhotosGetInfo(photoID);
var allSets = fl.PhotosetsGetList();
var blogSet = allSets
.FirstOrDefault(s => s.Description == "Blog Uploads");
if (blogSet != null)
fl.PhotosetsAddPhoto(blogSet.PhotosetId, photo.PhotoId);
FlickrPhoto fphoto = new FlickrPhoto();
fphoto.Description = photo.Description;
fphoto.WebUrl = photo.MediumUrl;
fphoto.Title = photo.Title;
fphoto.Description = photo.Description;
return fphoto;
}
}
示例4: GetDescription
private void GetDescription(string photoId)
{
Flickr flickr = new Flickr(flickrKey, sharedSecret);
PhotoInfo info = flickr.PhotosGetInfo(photoId);
PhotoDescription.Text = info.Description;
PhotoDateTaken.Text = info.DateTaken.ToString("MMMM dd, yyyy");
}
示例5: getFlickrPic
/// <summary>
/// Using the PhotoID gets the Photo Description (Contains FEN Move) from Flickr
/// </summary>
/// <param name="photoID">The Flickr Photo ID to get</param>
/// <returns>The FEN Chess Move</returns>
public static string getFlickrPic(string photoID)
{
try
{
string consumerKey = ConfigurationManager.AppSettings["FlickrConsumerKey"];
Flickr flickr = new Flickr(consumerKey);
PhotoInfo photoInfo = flickr.PhotosGetInfo(photoID); //ChessBoard
string photoTitle = photoInfo.Title;
return photoInfo.Description; //This has the FEN move
}
catch (Exception)
{
throw new System.ArgumentException("Cannot get Flickr image", "flickr");
}
}
示例6: ApiSpike_GetInfo
public void ApiSpike_GetInfo()
{
var client = new Flickr(Settings.Flickr.ApiKey, Settings.Flickr.SharedSecret);
client.InstanceCacheDisabled = true;
var photos = client.PhotosSearch(new PhotoSearchOptions(Settings.Flickr.UserId, "blog"));
var result = new List<Tuple<string,string>>();
foreach (var photo in photos)
{
var info = client.PhotosGetInfo(photo.PhotoId, photo.Secret);
result.Add(new Tuple<string, string>(info.Title, info.Description));
}
Assert.That(result, Is.Not.Empty);
}
示例7: getFlickrPic
public static bool getFlickrPic(string photoID, out string photoDescription)
{
string consumerKey = "8d25fce60055946ae5f7e1dff9a5b955";
try
{
Flickr flickr = new Flickr(consumerKey);
PhotoInfo photoInfo = flickr.PhotosGetInfo(photoID); //ChessBoard
string photoTitle = photoInfo.Title;
photoDescription = photoInfo.Description; //This has the FEN move
return true;
}
catch (WebException)
{
photoDescription = "Error: Could not get the Image from Flickr";
return false;
}
catch (Exception)
{
photoDescription = "Error: Could not get the Image from Flickr";
return false;
}
}
示例8: RetrieveFlickrInfo
public static FlickrInfo RetrieveFlickrInfo(string id)
{
LOG.InfoFormat("Retrieving flickr info for {0}", id);
FlickrInfo flickrInfo = new FlickrInfo();
Flickr flickr = new Flickr(Flickr_API_KEY, Flickr_SHARED_SECRET, config.flickrToken);
PhotoInfo photoInfo = flickr.PhotosGetInfo(id);
flickrInfo.ID = id;
flickrInfo.Title = photoInfo.Title;
flickrInfo.Timestamp = photoInfo.DatePosted;
flickrInfo.Description = photoInfo.Description;
flickrInfo.LargeUrl = photoInfo.LargeUrl;
flickrInfo.MediumUrl = photoInfo.MediumUrl;
flickrInfo.OriginalUrl = photoInfo.OriginalUrl;
flickrInfo.SquareThumbnailUrl = photoInfo.SquareThumbnailUrl;
flickrInfo.WebUrl = photoInfo.WebUrl;
flickr = null;
return flickrInfo;
}