PhotosGetInfo() public méthode

Get information about a photo. The calling user must have permission to view the photo.
public PhotosGetInfo ( string photoId ) : PhotoInfo
photoId string The id of the photo to fetch information for.
Résultat PhotoInfo
        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;
            }
        }
 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;
 }
Exemple #3
0
        public static PhotoInfo GetPhotoInfo(string photoId)
        {
            Flickr flickr = new Flickr(ConfigurationManager.AppSettings["apiKey"],
                ConfigurationManager.AppSettings["sharedSecret"]);

            return flickr.PhotosGetInfo(photoId);
        }
        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");
        }
 /// <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");
     }
 }
Exemple #6
0
        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);
        }
Exemple #7
0
        private void AddPhotoToList(FlickrNet.Flickr f, FlickrNet.Photo flickrPhoto, Photoset photoset)
        {
            // Filter by date, if filter option enabled and date taken is known.
            if (!Settings.FilterByDate ||
                flickrPhoto.DateTakenUnknown ||
                (flickrPhoto.DateTaken.Date >= Settings.StartDate && flickrPhoto.DateTaken.Date <= Settings.StopDate))
            {
                Photo photo = new Photo(flickrPhoto, photoset);
                PhotoList.Add(photo);

                // Get the photo info to get the raw tags, and put them into the photo object.
                // The raw tags are as uploaded or entered -- with spaces, punctuation, and
                // upper/lower case.
                FlickrNet.PhotoInfo info = f.PhotosGetInfo(flickrPhoto.PhotoId);
                photo.Tags.Clear();
                for (int i = 0; i < info.Tags.Count; i++)
                {
                    photo.Tags.Add(info.Tags[i].Raw);
                }
            }
        }
        public override void CreateContentFromUrl(string url, ref string title, ref string newContent)
        {
            Match m = Regex.Match(url, PHOTO_REGEX_URL);

            if (!m.Success)
            {
                base.CreateContentFromUrl(url, ref title, ref newContent);
            }
            else
            {
                string photoId = m.Groups["id"].Value;

                // get photo
                FlickrNet.Flickr flickrProxy = FlickrPluginHelper.GetFlickrProxy();

                FlickrNet.PhotoInfo photo = flickrProxy.PhotosGetInfo(photoId);

                title      = photo.Title;
                newContent = string.Format("<p><a href=\"{0}\" title=\"{2}\"><img alt=\"{2}\" border=\"0\" src=\"{1}\"></a></p>", photo.WebUrl, photo.MediumUrl, HtmlServices.HtmlEncode(photo.Title));
            }
        }
 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;
     }
 }
        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;
        }