A photo can contain a source set of other photos!
430019
def source_photos
      return [] unless sources.kind_of? Array
      @source_photos ||= sources.map do |source| 
        RGallery::Photo.new source.src, options.merge(:sizing => source.sizing)
      end
    end
176777
def _get_photos(session, user_or_group_id):
        
        response = session.fetch_items("photos.getAll", Photo.from_json, count=200, owner_id=user_or_group_id)
        return response
1117151
function preload() {
    if (!currGroup) {
      return;
    }
    var prev = new Image();
    var next = new Image();
    var pos = getPos(currThumbnail, currGroup);
    if (pos === (currImages.length - 1)) {
      // last image in group, preload first image and the one before
      prev.src = getAttr(currImages[currImages.length - 1], _const_dataattr) || currImages[currImages.length - 1].src;
      next.src = getAttr(currImages[0].src, _const_dataattr) || currImages[0].src;
    }
    else
      if (pos === 0) {
        // first image in group, preload last image and the next one
        prev.src = getAttr(currImages[currImages.length - 1], _const_dataattr) || currImages[currImages.length - 1].src;
        next.src = getAttr(currImages[1], _const_dataattr) || currImages[1].src;
      }
      else {
        // in between, preload prev & next image
        prev.src = getAttr(currImages[pos - 1], _const_dataattr) || currImages[pos - 1].src;
        next.src = getAttr(currImages[pos + 1], _const_dataattr) || currImages[pos + 1].src;
      }
  }
1353113
private void parseImagesAndInternalLinks(SpanManager sm,
			List<Span> linkSpans, List<Link> links)
	{

		sm.manageList(linkSpans);

		int pos = -1;
		Stack<Integer> linkOpenTags = new Stack<Integer>();
		while ((pos = sm.indexOf("[[", pos + 1)) != -1)
		{
			linkOpenTags.push(pos);
		}

		Span lastLinkSpan = new Span(sm.length() + 1, sm.length() + 1);
		Link.type linkType = Link.type.INTERNAL;

		while (!linkOpenTags.empty())
		{
			int linkStartTag = linkOpenTags.pop();
			int linkEndTag = sm.indexOf("]]", linkStartTag);
			if (linkEndTag == -1)
			{
				continue;
			}

			int linkOptionTag = sm.indexOf("|", linkStartTag, linkEndTag);

			int linkTextStart;
			String linkTarget;

			if (linkOptionTag != -1)
			{
				linkTextStart = linkOptionTag + 1;
				linkTarget = sm.substring(new Span(linkStartTag + 2,
						linkOptionTag).trim(sm));
			}
			else
			{
				linkTextStart = linkStartTag + 2;
				linkTarget = sm
						.substring(new Span(linkStartTag + 2, linkEndTag)
								.trim(sm));
			}

			// is is a regular link ?
			if (linkTarget.indexOf(lineSeparator) != -1)
			{
				continue;
			}
			linkTarget = encodeWikistyle(linkTarget);

			// so it is a Link or image!!!
			List<String> parameters;

			String namespace = getLinkNameSpace(linkTarget);
			if (namespace != null)
			{
				if (imageIdentifers.indexOf(namespace) != -1)
				{
					if (linkOptionTag != -1)
					{
						int temp;
						while ((temp = sm.indexOf("|", linkTextStart,
								linkEndTag)) != -1)
						{
							linkTextStart = temp + 1;
						}

						parameters = tokenize(sm, linkOptionTag + 1,
								linkEndTag, "|");

						// maybe there is an external link at the end of the
						// image description...
						if (sm.charAt(linkEndTag + 2) == ']'
								&& sm.indexOf("[", linkTextStart, linkEndTag) != -1)
						{
							linkEndTag++;
						}
					}
					else
					{
						parameters = null;
					}
					linkType = Link.type.IMAGE;
				}
				else
				{
					//Link has namespace but is not image
					linkType = Link.type.UNKNOWN;
					parameters = null;
				}
			}
			else
			{
				if (linkType == Link.type.INTERNAL
						&& lastLinkSpan.hits(new Span(linkStartTag,
								linkEndTag + 2)))
				{
					continue;
				}
				parameters = null;
				linkType = Link.type.INTERNAL;
			}

			Span posSpan = new Span(linkTextStart, linkEndTag).trim(sm);
			linkSpans.add(posSpan);

			Link l = new Link(null, posSpan, linkTarget, linkType, parameters);
			links.add(l);

			if (calculateSrcSpans)
			{
				l.setSrcSpan(new SrcSpan(sm.getSrcPos(linkStartTag), sm
						.getSrcPos(linkEndTag + 2)));
			}

			sm.delete(posSpan.getEnd(), linkEndTag + 2);
			sm.delete(linkStartTag, posSpan.getStart());

			// removing line separators in link text
			int lsinlink;
			while ((lsinlink = sm.indexOf(lineSeparator, posSpan)) != -1)
			{
				sm.replace(lsinlink, lsinlink + lineSeparator.length(), " ");
			}

			lastLinkSpan = posSpan;
		}
	}
41113
private function altImagesToUnique()
    {
        if ($this->alternateImageUrls->count() === 0) {
            return;
        }
        $images = $this->getAlternateImageUrls();
        $resetImages = false;
        $duplicates = array_count_values($images);
        foreach ($duplicates as $val => $count) {
            if ($count > 1) {
                $resetImages = true;
                $images = array_unique($images);
                break;
            }
        }
        $key = array_search($this->getImageUrl(), $images, true);
        if ($key !== false) {
            $resetImages = true;
            unset($images[$key]);
        }
        if ($resetImages) {
            $this->setAlternateImageUrls(array_values($images));
        }
    }
255119
def _generate_examples(self, archive):
    

    for fname, fobj in archive:
      res = _NAME_RE.match(fname)
      if not res:  # if anything other than .png; skip
        continue
      label = res.group(2).lower()
      yield {
          "image": fobj,
          "label": label,
      }
329963
def haveSnapshots(self):
		""""""
		return os.path.islink(self.latestLink) and os.path.isdir(self.latestLink)
1017644
function( isUndo )
		{
			var snapshots = this.snapshots,
				currentImage = this.currentImage,
				image, i;

			if ( currentImage )
			{
				if ( isUndo )
				{
					for ( i = this.index - 1 ; i >= 0 ; i-- )
					{
						image = snapshots[ i ];
						if ( !currentImage.equals( image, true ) )
						{
							image.index = i;
							return image;
						}
					}
				}
				else
				{
					for ( i = this.index + 1 ; i < snapshots.length ; i++ )
					{
						image = snapshots[ i ];
						if ( !currentImage.equals( image, true ) )
						{
							image.index = i;
							return image;
						}
					}
				}
			}

			return null;
		}
1155771
def replace(self, photo_file, **kwds):
        
        result = self._client.photo.replace(self, photo_file, **kwds)
        self._replace_fields(result.get_fields())
1282655
def update(self, photos, **kwds):
        
        ids = [self._extract_id(photo) for photo in photos]
        return self._client.post("/photos/update.json", ids=ids,
                                 **kwds)["result"]
200163
def put_photo(self, image, album_path="me/photos", **kwargs):
        
        return self.request(
            "{0}/{1}".format(self.version, album_path),
            post_args=kwargs,
            files={"source": image},
            method="POST",
        )
279754
def photos
      return all_photos if @json["photos"].blank?
      @json["photos"]["groups"].select { |g| g["type"] == "venue" }.first["items"].map do |item|
        Foursquare::Photo.new(@foursquare, item)
      end
    end
865994
def attach_photo(self, photo: typing.Union[InputMediaPhoto, base.InputFile],
                     caption: base.String = None):
        
        if not isinstance(photo, InputMedia):
            photo = InputMediaPhoto(media=photo, caption=caption)
        self.attach(photo)
808632
def _parse_photo(photo):
    """"""
    owner = User(photo.owner)
    title = photo.title
    ispublic = photo.ispublic
    isfriend = photo.isfriend
    isfamily = photo.isfamily
    secret = photo.secret
    server = photo.server
    p = Photo(photo.id, owner=owner, title=title, ispublic=ispublic,\
              isfriend=isfriend, isfamily=isfamily, secret=secret, \
              server=server)        
    return p
1108847
def getPhotos(self):
        """"""
        method = 'flickr.photosets.getPhotos'
        data = _doget(method, photoset_id=self.id)
        photos = data.rsp.photoset.photo
        p = []
        for photo in photos:
            p.append(Photo(photo.id, title=photo.title, secret=photo.secret, \
                           server=photo.server))
        return p
1274866
def editPhotos(self, photos, primary=None):
        
        method = 'flickr.photosets.editPhotos'

        if primary is None:
            primary = self.primary
            
        ids = [photo.id for photo in photos]
        if primary.id not in ids:
            ids.append(primary.id)

        _dopost(method, auth=True, photoset_id=self.id,\
                primary_photo_id=primary.id,
                photo_ids=ids)
        self.__count = len(ids)
        return True
878620
def getPhotos(self, tags='', per_page='', page=''):
        """"""
        method = 'flickr.groups.pools.getPhotos'
        data = _doget(method, group_id=self.id, tags=tags,\
                      per_page=per_page, page=page)
        photos = []
        for photo in data.rsp.photos.photo:
            photos.append(_parse_photo(photo))
        return photos