delete_resources() public method

public delete_resources ( $public_ids, $options = [] )
 public function delete($filename)
 {
     $file = new RootFile($filename);
     $public_id = str_replace('.' . $file->getExtension(), '', $filename);
     $api = new Cloudinary\Api();
     $response = $api->delete_resources($public_id);
     return true;
 }
Ejemplo n.º 2
0
 /**
  * @expectedException \Cloudinary\Api\NotFound
  */
 function test09_delete_resources()
 {
     // should allow deleting resources
     \Cloudinary\Uploader::upload("tests/logo.png", array("public_id" => "api_test3"));
     $resource = $this->api->resource("api_test3");
     $this->assertNotEquals($resource, NULL);
     $this->api->delete_resources(array("apit_test", "api_test2", "api_test3"));
     $this->api->resource("api_test3");
 }
Ejemplo n.º 3
0
 function test09_delete_resources()
 {
     // should allow deleting resources
     Curl::mockApi($this);
     $this->api->delete_resources(array("apit_test", self::$api_test_2, self::$api_test_3), array("transformation" => "c_crop,w_100"));
     assertUrl($this, "/resources/image/upload");
     $this->assertEquals("DELETE", Curl::$instance->http_method(), "http method should be DELETE");
     assertParam($this, "public_ids[0]", "apit_test");
     assertParam($this, "transformation", "c_crop,w_100");
 }
 function test34_restore()
 {
     \Cloudinary\Uploader::upload("tests/logo.png", array("public_id" => "api_test_restore", "backup" => TRUE));
     $resource = $this->api->resource("api_test_restore");
     $this->assertNotEquals($resource, NULL);
     $this->assertEquals($resource["bytes"], 3381);
     $this->api->delete_resources(array("api_test_restore"));
     $resource = $this->api->resource("api_test_restore");
     $this->assertNotEquals($resource, NULL);
     $this->assertEquals($resource["bytes"], 0);
     $this->assertEquals($resource["placeholder"], TRUE);
     $response = $this->api->restore(array("api_test_restore"));
     $info = $response["api_test_restore"];
     $this->assertNotEquals($info, NULL);
     $this->assertEquals($info["bytes"], 3381);
     $resource = $this->api->resource("api_test_restore");
     $this->assertNotEquals($resource, NULL);
     $this->assertEquals($resource["bytes"], 3381);
 }