Upload image to cloud.

@param  mixed $source
@param  string $publicId
@param  array  $tags
@return CloudinaryWrapper
172900
public function upload($source, $publicId, $tags = array())
    {
        $defaults = array(
            'public_id' => null,
            'tags'      => array()
        );

        $options = array_merge($defaults, array(
            'public_id' => $publicId,
            'tags'      => $tags
        ));

        $this->uploadedResult = $this->getUploader()->upload($source, $options);

        return $this;
    }
583703
public static function createTag($tag, $attributes, $content = null)
    {
        $tag = strtolower($tag);

        // Build list of arguments
        $preparedAttributes = '';
        foreach ($attributes as $attributeKey => $attributeValue) {
            // Only set non-empty strings (ensures strlen(0) > 0)
            if (strlen($attributeValue) > 0) {
                $preparedAttributes .= sprintf(
                    ' %s="%s"',
                    $attributeKey,
                    Convert::raw2att($attributeValue)
                );
            }
        }

        // Check void element type
        if (in_array($tag, static::config()->get('void_elements'))) {
            if ($content) {
                throw new InvalidArgumentException("Void element \"{$tag}\" cannot have content");
            }
            return "<{$tag}{$preparedAttributes} />";
        }

        // Closed tag type
        return "<{$tag}{$preparedAttributes}>{$content}</{$tag}>";
    }
198167
public function bulkUpsert($source, $documents, $primaryKey)
    {
        $namespace = strpos($source, '.') !== false ? $source : ($this->_default_db . '.' . $source);

        $this->eventsManager->fireEvent('mongodb:beforeBulkUpsert', $this, ['namespace' => $namespace]);

        /** @var \ManaPHP\Mongodb\ConnectionInterface $connection */
        $connection = $this->poolManager->pop($this);
        try {
            $count = $connection->bulkUpsert($namespace, $documents, $primaryKey);
        } finally {
            $this->poolManager->push($this, $connection);
        }
        $this->eventsManager->fireEvent('mongodb:afterBulkUpsert', $this);

        $this->logger->info(compact('count', 'namespace', 'documents'), 'mongodb.bulk.upsert');
        return $count;
    }
904402
public function updateOne(int $sourceId, array $tags, int $otpCode = null, string $ipaddr = '') : array {
        $array = [
            'tags' => $tags
        ];

        if ($otpCode !== null) {
            $array['otpCode'] = $otpCode;
        }

        return $this->sendPatch(
            sprintf('/profiles/%s/sources/%s', $this->userName, $sourceId),
            [],
            $array
        );
    }
43871
public function addUploadMethods(PrepareUnserializedSettings $event)
    {
        // these are the upload methods that doesn't require external libraries
        $methods = [
            'local',
            'imgur'
        ];

        // check for Cloudinary, if present add the method
        if (class_exists(Cloudinary::class)) {
            $methods[] = 'cloudinary';
        }

        // add the methods with the relative translations
        $event->settings['flagrow.image-upload.availableUploadMethods'] = [];
        foreach ($methods as $method) {
            $event->settings['flagrow.image-upload.availableUploadMethods'][$method] = app('translator')->trans('flagrow-image-upload.admin.upload_methods.' . $method);
        }
    }
368681
public function addEndpoint($publicUrl, $adminUrl)
    {
        $endpoint = new Endpoint();
        $endpoint->setPublicUrl($publicUrl);
        $endpoint->setAdminUrl($adminUrl);
        $endpoint->setService($this);

        $this->endpoints[] = $endpoint;

        return $this;
    }
392252
public function transferTagAttributeLinks($tagId, $targetTagId)
    {
        $query = $this->handler->createSelectQuery();
        $query
            ->select('*')
            ->from($this->handler->quoteTable('eztags_attribute_link'))
            ->where(
                $query->expr->eq(
                    $this->handler->quoteColumn('keyword_id'),
                    $query->bindValue($tagId, null, PDO::PARAM_INT)
                )
            );

        $statement = $query->prepare();
        $statement->execute();

        $rows = $statement->fetchAll(PDO::FETCH_ASSOC);

        $updateLinkIds = [];
        $deleteLinkIds = [];

        foreach ($rows as $row) {
            $query = $this->handler->createSelectQuery();
            $query
                ->select(
                    $this->handler->quoteColumn('id')
                )
                ->from($this->handler->quoteTable('eztags_attribute_link'))
                ->where(
                    $query->expr->lAnd(
                        $query->expr->eq(
                            $this->handler->quoteColumn('objectattribute_id'),
                            $query->bindValue($row['objectattribute_id'], null, PDO::PARAM_INT)
                        ),
                        $query->expr->eq(
                            $this->handler->quoteColumn('objectattribute_version'),
                            $query->bindValue($row['objectattribute_version'], null, PDO::PARAM_INT)
                        ),
                        $query->expr->eq(
                            $this->handler->quoteColumn('keyword_id'),
                            $query->bindValue($targetTagId, null, PDO::PARAM_INT)
                        )
                    )
                );

            $statement = $query->prepare();
            $statement->execute();

            $targetRows = $statement->fetchAll(PDO::FETCH_ASSOC);

            if (empty($targetRows)) {
                $updateLinkIds[] = $row['id'];
            } else {
                $deleteLinkIds[] = $row['id'];
            }
        }

        if (!empty($deleteLinkIds)) {
            $query = $this->handler->createDeleteQuery();
            $query
                ->deleteFrom($this->handler->quoteTable('eztags_attribute_link'))
                ->where(
                    $query->expr->in(
                        $this->handler->quoteColumn('id'),
                        $deleteLinkIds
                    )
                );

            $query->prepare()->execute();
        }

        if (!empty($updateLinkIds)) {
            $query = $this->handler->createUpdateQuery();
            $query
                ->update($this->handler->quoteTable('eztags_attribute_link'))
                ->set(
                    $this->handler->quoteColumn('keyword_id'),
                    $query->bindValue($targetTagId)
                )->where(
                    $query->expr->in(
                        $this->handler->quoteColumn('id'),
                        $updateLinkIds
                    )
                );

            $query->prepare()->execute();
        }
    }
500502
public function update(string $domain, string $tag, string $description)
    {
        Assert::stringNotEmpty($domain);
        Assert::stringNotEmpty($tag);

        $params = [
            'description' => $description,
        ];

        $response = $this->httpPut(sprintf('/v3/%s/tags/%s', $domain, $tag), $params);

        return $this->hydrateResponse($response, UpdateResponse::class);
    }
1015936
public function updateBatchTags(
        $batchId, array $tagsToAdd, array $tagsToRemove
    ) {
        $json = Serialize::tagsUpdate($tagsToAdd, $tagsToRemove);
        $result = $this->_post($this->_batchUrl($batchId, '/tags'), $json);
        return Deserialize::tags($result);
    }
1314750
private function preload($attributesByTag, $locale, $published = true)
    {
        $hrefsByType = [];
        foreach ($attributesByTag as $attributes) {
            $provider = $this->getValue($attributes, 'provider', self::DEFAULT_PROVIDER);
            if (!array_key_exists($provider, $hrefsByType)) {
                $hrefsByType[$provider] = [];
            }

            $hrefsByType[$provider][] = $attributes['href'];
        }

        $result = [];
        foreach ($hrefsByType as $provider => $hrefs) {
            $items = $this->linkProviderPool->getProvider($provider)->preload(
                array_unique($hrefs),
                $locale,
                $published
            );

            foreach ($items as $item) {
                $result[$provider . '-' . $item->getId()] = $item;
            }
        }

        return $result;
    }
1077755
public function updateGroupTags(
        $groupId, array $tagsToAdd, array $tagsToRemove
    ) {
        $json = Serialize::tagsUpdate($tagsToAdd, $tagsToRemove);
        $result = $this->_post($this->_groupUrl($groupId, '/tags'), $json);
        return Deserialize::tags($result);
    }
421130
public function uploadFile($sourcePath, $targetPath, $publicAccess = true, $allowRewriteFile = false)
	{
		// check if the file does not already exists, if exist, don't upload
		if ($allowRewriteFile !== true && $this->isFile($targetPath)) {
			return false;
		}
		return $this->s3Client->putObject(array(
			'Bucket'     => $this->getBucket(),
			'Key'        => $targetPath,
			'SourceFile' => $sourcePath,
			'ACL'        => $publicAccess ? self::PUBLIC_READ : self::PRIVATE_ACCESS
		));
	}
594246
public function put($cacheGroupKey, array $params, $data, $tags = ['default'])
    {
        // Make sure caching is enabled
        if (!$this->isCachingEnabled()) {
            return false;
        }

        // Retrieve cache group settings
        $cacheGroup = $this->getCacheGroup($cacheGroupKey);

        // Set cache tag to group name
        if (!$tags) {
            $tags = $cacheGroupKey;
        }

        if (empty($cacheGroup) || (empty($cacheGroup['active']) || empty($cacheGroup['key']))) {
            return false;
        }

        // Generate cache key
        $cacheKey = $this->generateCacheKey($cacheGroup['key'], $params);

        // Make sure we have an array of tags
        if (!is_array($tags)) {
            $tags = [$tags];
        }

        try {
            return IlluminateCache::tags($tags)
                                  ->put($cacheKey, $data, $cacheGroup['lifetime'] ?: $this->config['lifetime']);
        } // predis bug with WRONG OPERATOR
        catch (ServerException $e) {
            cache_wipe();

            try {
                $errors = [
                    'exception' => $e->getMessage(),
                    'type'      => 'redis wrong type',
                    'tags'      => $tags,
                    'cache_key' => $cacheKey,
                ];

                // Notify bugsnag
                app('nodes.bugsnag')->notifyException($e, json_encode($errors), 'error');
            } catch (\Exception $e) {
                // Fail silent
            }
        }
    }
210734
public function create($tagName, $tagId = null)
    {
        $params = array(
                    'tagname' => $tagName,
                    'tagid'   => $tagId
                );

        return $this->http->jsonPost(self::API_CREATE, $params);
    }
913828
public function addImage($source)
    {
        $images   = $this->getImages();
        $images[] = $source;
        
        $this->setData('images', $images);
        
        return $this;
    }
343717
public static function addAttributes(ParserTag $tag, FileRepository $files)
    {
        $file = $files->findByUuid($tag->getAttribute('uuid'));
        $tag->setAttribute('base_name', $file->base_name);
        $tag->setAttribute('downloads', $file->downloads->count());
        $tag->setAttribute('size', $file->humanSize);

        return true;
    }
721634
public function create(string $tagName)
    {
        return self::$curl->post(self::CREATE.self::$access_token, json_encode([
                'tag' => [
                    'name' => $tagName,
                ],
            ]
        ));
    }