File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -201,9 +201,10 @@ public function setup() {
201201 */
202202 public function upload_asset ( $ attachment_id ) {
203203
204- $ type = $ this ->sync ->get_sync_type ( $ attachment_id );
205- $ options = $ this ->media ->get_upload_options ( $ attachment_id );
206- $ public_id = $ options ['public_id ' ];
204+ $ type = $ this ->sync ->get_sync_type ( $ attachment_id );
205+ $ options = $ this ->media ->get_upload_options ( $ attachment_id );
206+ $ public_id = $ options ['public_id ' ];
207+ $ try_remote = 'cloud_name ' === $ type ? 'file ' : false ;
207208
208209 // Add the suffix before uploading.
209210 if ( $ this ->media ->get_public_id ( $ attachment_id ) === $ public_id ) {
@@ -215,7 +216,7 @@ public function upload_asset( $attachment_id ) {
215216 }
216217
217218 // Run the upload Call.
218- $ result = $ this ->connect ->api ->upload ( $ attachment_id , $ options );
219+ $ result = $ this ->connect ->api ->upload ( $ attachment_id , $ options, $ try_remote );
219220
220221 if ( ! is_wp_error ( $ result ) ) {
221222
You can’t perform that action at this time.
0 commit comments