Add a photo in user's collection
@param int $photo_id photo id from photo to add
@return array [photo, collection]
15737
public function add($photo_id)
    {
        $photo_and_collection = json_decode(
            self::post(
                "/collections/{$this->id}/add",
                ['query' => ['photo_id' => $photo_id]]
            )->getBody(),
            true
        );

        # Reset
        $this->photos = [];
    }
1142836
public function openidImage($media_id = '', $openids = [])
    {
        $queryStr                      = [];
        $queryStr['touser']            = $openids;
        $queryStr['image']['media_id'] = $media_id;
        $queryStr['msgtype']           = 'image';

        $this->module = 'message';

        $res = $this->_post('mass/send', $queryStr);

        return $res;
    }
813060
public function sendImage($toUser, $media_id)
    {
        $ret = array();
        $ret['touser'] = $toUser;
        $ret['msgtype'] = 'image';
        $ret['image']['media_id'] = $media_id;
        return $this->send($ret);
    }
1302513
public function add($photo)
    {
        if (is_array($photo)) {
            $this->collection[] = new Photo($photo);
        } elseif (is_object($photo) && $photo instanceof Photo) {
            $this->collection[] = $photo;
        }

        return $this;
    }
1260355
public function actionPhotosDelete()
    {
        $request = Yii::$app->request;
        $photoIds = $request->post('ids'); // Array or selected records primary keys
        $photoModels = GalleryPhoto::findAll($photoIds);
        if(empty($photoModels)) return null;
        $galleryModel = $this->findModel($photoModels[0]->gallery_id);
        $dir = Yii::getAlias('@app/web/img/gallery/' . Translator::rus2translit($galleryModel->name));
        foreach ($photoModels as $photo){
            try{
                unlink($dir . '/' . $photo->name);
                unlink($dir . '/thumb/' . $photo->name);
            } catch (\Exception $e){
                echo('Не удалось удалить файл ' . $photo->name . ' - ' . $e->getMessage());
            }
        }
        GalleryPhoto::deleteAll(['photo_id' => $photoIds]);

        if ($request->isAjax) {
            Yii::$app->response->format = Response::FORMAT_JSON;
            return true;
        } else {
            return $this->redirect(['index']);
        }

    }
206155
public T photos_upload(File photo)
    throws FacebookException, IOException {
    return photos_upload(photo, /*caption*/ null, /*albumId*/ null) ;
  }
1170877
function photos_geo_getLocation($photo_id)
    {
        /** http://www.flickr.com/services/api/flickr.photos.geo.getLocation.html */
        $this->request("flickr.photos.geo.getLocation", array("photo_id"=>$photo_id));
        return $this->parsed_response ? $this->parsed_response['photo'] : false;
    }
965889
public function add($photo)
    {
        if (is_array($photo)) {
            $this->collection[] = new ModelVisualPhoto($photo);
        } elseif (is_object($photo) && $photo instanceof ModelVisualPhoto) {
            $this->collection[] = $photo;
        }

        return $this;
    }
273503
public function addEmployeePhoto($employeeId, $index, $base64Data)
    {
        $result = false;

        $indexes   = [1, 2];
        $freeIndex = 0;

        if ($index === null) {
            foreach ($indexes as $index) {
                if (($photoInfo = $this->getEmployeePhoto($employeeId, $index)) !== false
                    && (!isset($photoInfo->GetAcsEmployeePhotoResult) || $photoInfo->GetAcsEmployeePhotoResult
                        == null)
                ) {
                    $freeIndex = $index;
                    break;
                }
            }
        } else {
            $freeIndex = $index;
        }
        if ($freeIndex > 0) {
            $this->addHeader();
            try {
                $result = $this->getSoap()->SetAcsEmployeePhoto([
                    'employeeId' => $employeeId,
                    'photoNumber' => $freeIndex,
                    'data' => $base64Data
                ]);
            } catch (\SoapFault $ex) {
                $result = false;
                $this->logError();
            }
        }
        return $result;
    }
214930
public function getPhoto() {
		if(is_null($photo = $this->tag->getChild('PHOTO'))) {
			return NULL;
		} else {
			try {
				return new Avatar($photo);
			} catch(Exception $e) {
				return NULL;
			}
		}
	}
332701
def _add_photo(self, card, name):
        """"""
        try:
            photo_file = join(dirname(self._filename), 'photo/%s.jpeg' % name)
            jpeg = open(photo_file, 'rb').read()
            photo = card.add('photo')
            photo.type_param = 'jpeg'
            photo.encoding_param = 'b'
            photo.value = jpeg
        except IOError:
            pass
783781
public Collection<User> getFavorites(String photoId, int perPage, int page) throws FlickrException {
        Map<String, Object> parameters = new HashMap<String, Object>();

        parameters.put("method", METHOD_GET_FAVORITES);

        parameters.put("photo_id", photoId);

        if (perPage > 0) {
            parameters.put("per_page", Integer.toString(perPage));
        }

        if (page > 0) {
            parameters.put("page", Integer.toString(page));
        }

        Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);
        if (response.isError()) {
            throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
        }
        List<User> users = new ArrayList<User>();

        Element userRoot = response.getPayload();
        NodeList userNodes = userRoot.getElementsByTagName("person");
        for (int i = 0; i < userNodes.getLength(); i++) {
            Element userElement = (Element) userNodes.item(i);
            User user = new User();
            user.setId(userElement.getAttribute("nsid"));
            user.setUsername(userElement.getAttribute("username"));
            user.setFaveDate(userElement.getAttribute("favedate"));
            users.add(user);
        }
        return users;
    }
372286
def add(photo)
      response = JSON.parse(connection.post("/collections/#{id}/add", { photo_id: photo.id }).body)
      {
        photo_id:      response["photo"]["id"],
        collection_id: response["collection"]["id"],
        user_id:       response["user"]["id"],
        created_at:    response["created_at"]
      }
    end
139095
static function thumbnailFromUserId( $user_id, $size ) {

		$image_url = get_user_meta( $user_id, 'pb_catalog_logo', true );
		$book = get_active_blog_for_user( $user_id );
		if ( $book ) {
			switch_to_blog( $book->blog_id );
			$image_url = \Pressbooks\Image\thumbnail_from_url( $image_url, $size );
			restore_current_blog();
		}

		return $image_url;
	}
1341964
public function add($project_id, $person_id)
    {
        $this->validates($project_id, $person_id);
        return $this->rest->post("projects/$project_id/people/$person_id");
    }
1349012
public function parsePhotos($id = null)
    {
        $url = (isset($id)) ? '/extradata/public/users/' . $id . '/photos' : '/extradata/public/photos';
        list($data) = $this->_callUrl($this->api_base . $url, true);

        $photos = array();

        if ($data) {
            foreach ($data as $photo_data) {
                $temp_photo = new Photo();
                $temp_photo->parse($photo_data);
                $photos[] = $temp_photo;
                unset($temp_photo);
            }
        }

        return $photos;
    }
101187
public function reorder($photo_ids)
    {
        if (count($photo_ids) == 1) {
            if ($edge = $this->getService('repos:photos.edge')
                              ->fetch(array(
                                        'set' => $this,
                                        'photo.id' => $photo_ids[0],
                                      ))
            ) {
                $edge->ordering = $this->photos->getTotal();
            }

            return;
        }

        foreach ($photo_ids as $index => $photo_id) {
            if ($edge = $this->getService('repos:photos.edge')
                             ->fetch(array(
                                      'set' => $this,
                                      'photo.id' => $photo_id, ))
            ) {
                $edge->ordering = $index + 1;
            }
        }
    }