Cloudinary\Api::update PHP Method

update() public method

public update ( $public_id, $options = [] )
    function update($public_id, $options = array())
    {
        $resource_type = \Cloudinary::option_get($options, "resource_type", "image");
        $type = \Cloudinary::option_get($options, "type", "upload");
        $uri = array("resources", $resource_type, $type, $public_id);
        $tags = \Cloudinary::option_get($options, "tags");
        $context = \Cloudinary::option_get($options, "context");
        $face_coordinates = \Cloudinary::option_get($options, "face_coordinates");
        $custom_coordinates = \Cloudinary::option_get($options, "custom_coordinates");
        $update_options = array_merge($this->only($options, array("moderation_status", "raw_convert", "ocr", "categorization", "detection", "similarity_search", "auto_tagging", "background_removal")), array("tags" => $tags ? implode(",", \Cloudinary::build_array($tags)) : $tags, "context" => $context ? \Cloudinary::encode_assoc_array($context) : $context, "face_coordinates" => $face_coordinates ? \Cloudinary::encode_double_array($face_coordinates) : $face_coordinates, "custom_coordinates" => $custom_coordinates ? \Cloudinary::encode_double_array($custom_coordinates) : $custom_coordinates));
        return $this->call_api("post", $uri, $update_options, $options);
    }

Usage Example

Example #1
0
 function test_update_parameters()
 {
     Curl::mockApi($this);
     $this->api->update(self::$api_test, array("auto_tagging" => 0.5));
     assertUrl($this, '/resources/image/upload/' . self::$api_test);
     assertParam($this, "auto_tagging", 0.5);
     $fields = Curl::$instance->fields();
     $this->assertArrayNotHasKey("face_coordinates", $fields, "update() should not send empty parameters");
     $this->assertArrayNotHasKey("tags", $fields, "update() should not send empty parameters");
     $this->assertArrayNotHasKey("context", $fields, "update() should not send empty parameters");
     $this->assertArrayNotHasKey("face_coordinates", $fields, "update() should not send empty parameters");
     $this->assertArrayNotHasKey("custom_coordinates", $fields, "update() should not send empty parameters");
 }
All Usage Examples Of Cloudinary\Api::update