Cloudinary\Api::delete_all_resources PHP Method

delete_all_resources() public method

public delete_all_resources ( $options = [] )
    function delete_all_resources($options = array())
    {
        $resource_type = \Cloudinary::option_get($options, "resource_type", "image");
        $type = \Cloudinary::option_get($options, "type", "upload");
        $uri = array("resources", $resource_type, $type);
        return $this->call_api("delete", $uri, array_merge(array("all" => True), $this->only($options, array("keep_original", "next_cursor", "invalidate"))), $options);
    }

Usage Example

Example #1
0
 function test19_delete_derived()
 {
     // should allow deleting all resources
     $this->markTestSkipped("Not enabled by default - remove this line to test");
     Uploader::upload(self::LOGO_PNG, array("public_id" => self::$api_test_5, "eager" => array("transformation" => array("width" => 101, "crop" => "scale"))));
     $resource = $this->api->resource(self::$api_test_5);
     $this->assertNotEquals($resource, NULL);
     $this->assertEquals(count($resource["derived"]), 1);
     $this->api->delete_all_resources(array("keep_original" => True));
     $resource = $this->api->resource(self::$api_test_5);
     $this->assertNotEquals($resource, NULL);
     $this->assertEquals(count($resource["derived"]), 0);
 }