function test31_update_upload_presets() { // should allow getting a single upload_preset $result = $this->api->create_upload_preset(array("folder" => "folder")); $name = $result["name"]; $preset = $this->api->upload_preset($name); $this->api->update_upload_preset($name, array_merge($preset["settings"], array("colors" => TRUE, "unsigned" => TRUE, "disallow_public_id" => TRUE))); $preset = $this->api->upload_preset($name); $this->assertEquals($preset["unsigned"], TRUE); $this->assertEquals($preset["settings"], array("folder" => "folder", "colors" => TRUE, "disallow_public_id" => TRUE)); $this->api->delete_upload_preset($name); }
function test29_get_upload_presets() { // should allow getting a single upload_preset $result = $this->api->create_upload_preset(array("unsigned" => TRUE, "folder" => "folder", "width" => 100, "crop" => "scale", "tags" => array("a", "b", "c"), "context" => array("a" => "b", "c" => "d"))); $name = $result["name"]; $preset = $this->api->upload_preset($name); $this->assertEquals($preset["name"], $name); $this->assertEquals($preset["unsigned"], TRUE); $settings = $preset["settings"]; $this->api->delete_upload_preset($name); $this->assertEquals($settings["folder"], "folder"); $this->assertEquals($settings["transformation"], array(array("width" => 100, "crop" => "scale"))); $this->assertEquals($settings["context"], array("a" => "b", "c" => "d")); $this->assertEquals($settings["tags"], array("a", "b", "c")); }
function test_upload_preset() { // should support unsigned uploading using presets $api = new \Cloudinary\Api(); $preset = $api->create_upload_preset(array("folder" => "upload_folder", "unsigned" => TRUE)); $result = Uploader::unsigned_upload(self::LOGO_PNG, $preset["name"]); $this->assertRegExp('/^upload_folder\\/[a-z0-9]+$/', $result["public_id"]); $api->delete_upload_preset($preset["name"]); }