Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,13 @@ public function prepare_upload( $post ) {
$public_id = $post->{Sync::META_KEYS['public_id']}; // use the __get method on the \WP_Post to get post_meta.
$dirs = wp_get_upload_dir();
$cld_folder = false;
$folder = trailingslashit( $dirs['cloudinary_folder'] );
if ( '/' === $dirs['cloudinary_folder'] ) {
$folder = '';
}
if ( empty( $public_id ) ) {
$file_info = pathinfo( $file );
$public_id = trailingslashit( $dirs['cloudinary_folder'] ) . $file_info['filename'];
$public_id = $folder . $file_info['filename'];
}

// Check if cloudinary folder is in public_id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'cloudinary_folder' => array(
'label' => __( 'Cloudinary folder path', 'cloudinary' ),
'description' => __( 'Specify the folder in your Cloudinary account where WordPress assets are uploaded to. All assets uploaded to WordPress from this point on will be synced to the specified folder in Cloudinary.', 'cloudinary' ),
'default' => trim( $base['host'], '/' ),
'default' => '/',
'sanitize_callback' => array( '\Cloudinary\Media', 'sanitize_cloudinary_folder' ),
'required' => true,
'suffix' => '<button type="submit" class="button button-primary">' . __( 'Save folder settings', 'cloudinary' ) . '</button>',
Expand Down