Skip to content

Commit 37bbc81

Browse files
nadavofitocker
authored andcommitted
Add async parameter to upload params (#65)
1 parent 8b89be2 commit 37bbc81

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Uploader.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public static function build_upload_params(&$options)
88
{
99
$params = array("timestamp" => time(),
1010
"allowed_formats" => \Cloudinary::encode_array(\Cloudinary::option_get($options, "allowed_formats")),
11+
"async" => \Cloudinary::option_get($options, "async"),
1112
"auto_tagging" => \Cloudinary::option_get($options, "auto_tagging"),
1213
"background_removal" => \Cloudinary::option_get($options, "background_removal"),
1314
"backup" => \Cloudinary::option_get($options, "backup"),

tests/UploaderTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function tearDown() {
3333

3434
public function test_upload() {
3535
$result = Uploader::upload(self::LOGO_PNG);
36-
print_r($result);
3736
switch ($result["resource_type"]) {
3837
case "image":
3938
// generate image tag
@@ -103,6 +102,13 @@ public function test_eager() {
103102
$this->assertArraySubset(array("eager"=> "c_scale,w_2.0"),$fields);
104103
}
105104

105+
public function test_upload_async() {
106+
Curl::mockUpload($this);
107+
Uploader::upload(self::LOGO_PNG, array("transformation"=>array("crop"=>"scale", "width"=>"2.0"), "async"=>TRUE));
108+
$fields = Curl::$instance->fields();
109+
$this->assertArraySubset(array("async"=> TRUE),$fields);
110+
}
111+
106112
public function test_headers() {
107113
Uploader::upload(self::LOGO_PNG, array("headers"=>array("Link: 1")));
108114
Uploader::upload(self::LOGO_PNG, array("headers"=>array("Link" => "1")));

0 commit comments

Comments
 (0)