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 @@ -1021,7 +1021,7 @@ public function down_sync_asset() {
if ( $format !== $file_info['extension'] ) {
// Format transformation.
$this->set_transformation( $transformations, 'fetch_format', $file_info['extension'] );
$url = $file_info['dirname'] . '/' . $file_info['filename'] . '.' . $format;
$url = $file_info['dirname'] . '/' . $file_info['filename'] . '.' . $file_info['extension'];
}
// Try to find the Attachment ID in context meta data.
$attachment_id = $this->get_id_from_sync_key( $sync_key );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,19 @@ public function cloudinary_url( $public_id, $args = array(), $size = array(), $c
$args['version'] = 'v1';
}

// Determine if we're dealing with a fetched
// ...or uploaded image and update the URL accordingly.
$asset_endpoint = filter_var( $public_id, FILTER_VALIDATE_URL ) ? 'fetch' : 'upload';

$url_parts = array(
'https:/',
$this->url( $args['resource_type'], 'upload' ),
$this->url( $args['resource_type'], $asset_endpoint ),
);

if ( ! empty( $args['transformation'] ) ) {
$url_parts[] = self::generate_transformation_string( $args['transformation'] );
}

// Add size.
if ( ! empty( $size ) && is_array( $size ) ) {
if ( true === $clean ) {
Expand All @@ -252,7 +258,7 @@ public function cloudinary_url( $public_id, $args = array(), $size = array(), $c
}

$url_parts[] = $args['version'];

$url_parts[] = $public_id;

// Clear out empty parts.
Expand Down