Skip to content

Commit a15aaea

Browse files
committed
fix _download() private to work in http embed mode
1 parent 2db25ea commit a15aaea

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

php/fotolia-api.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,11 @@ private function _download($download_url, $output_file = NULL, $http_auth_requir
341341
$ch = $this->_getCurlHandler($download_url);
342342

343343
if ($output_file === NULL) {
344-
$output_file = 'php://stdout';
344+
if ($this->_isShellMode()) {
345+
$output_file = 'php://stdout';
346+
} else {
347+
$output_file = 'php://output';
348+
}
345349
}
346350

347351
$output_fd = fopen($output_file, 'w');
@@ -1122,6 +1126,14 @@ private function _isPostMethod($method)
11221126

11231127
return $is_post_method;
11241128
}
1129+
1130+
/*
1131+
* Define if the api is called in CLI mode
1132+
*/
1133+
private function _isShellMode()
1134+
{
1135+
return !empty($_SERVER['SHELL']);
1136+
}
11251137
}
11261138

11271139
/**

0 commit comments

Comments
 (0)