@@ -286,8 +286,10 @@ public function filter_out_cloudinary( $content ) {
286286 }
287287
288288 $ original_url = $ urls [ $ result ['public_id ' ] ];
289- if ( ! empty ( $ result ['transformations ' ] ) ) {
290- $ original_url = str_replace ( $ result ['transformations ' ] . '/ ' , '/ ' , $ original_url );
289+ // Get merged transformations including overlays.
290+ $ merged_transformations = Relate::get_transformations ( $ result ['post_id ' ], true );
291+ if ( ! empty ( $ merged_transformations ) ) {
292+ $ original_url = str_replace ( $ merged_transformations . '/ ' , '/ ' , $ original_url );
291293 }
292294 $ size = $ this ->media ->get_size_from_url ( $ original_url );
293295 $ transformations = $ this ->media ->get_transformations_from_string ( $ original_url );
@@ -427,8 +429,10 @@ public function create_delivery( $attachment_id ) {
427429 $ transformations = null ;
428430 // Preserve pre-existing transformations.
429431 if ( $ relationship instanceof Relationship ) {
430- $ data = $ relationship ->get_data ();
431- $ transformations = isset ( $ data ['transformations ' ] ) ? $ data ['transformations ' ] : null ;
432+ $ transformations = Relate::get_transformations ( $ attachment_id , true );
433+ if ( empty ( $ transformations ) ) {
434+ $ transformations = null ;
435+ }
432436 }
433437 $ this ->delete_size_relationship ( $ attachment_id );
434438 $ size = $ this ->get_sized ( $ attachment_id );
@@ -1076,7 +1080,9 @@ public function convert_tags( $content, $context = 'view' ) {
10761080
10771081 $ base = $ type . ': ' . $ url ;
10781082 $ public_id = ! is_admin () ? $ relation ['public_id ' ] . '. ' . $ relation ['format ' ] : null ;
1079- $ cloudinary_url = $ this ->media ->cloudinary_url ( $ relation ['post_id ' ], array (), $ relation ['transformations ' ], $ public_id );
1083+ // Get merged transformations including overlays.
1084+ $ merged_transformations = Relate::get_transformations ( $ relation ['post_id ' ], true );
1085+ $ cloudinary_url = $ this ->media ->cloudinary_url ( $ relation ['post_id ' ], array (), $ merged_transformations , $ public_id );
10801086 if ( empty ( $ cloudinary_url ) ) {
10811087 continue ;
10821088 }
@@ -1099,14 +1105,16 @@ public function convert_tags( $content, $context = 'view' ) {
10991105 $ base = $ type . ': ' . $ url ;
11001106 $ relation = $ this ->known [ $ url ];
11011107 $ public_id = ! is_admin () ? $ relation ['public_id ' ] . '. ' . $ relation ['format ' ] : null ;
1108+ // Get merged transformations including overlays.
1109+ $ merged_transformations = Relate::get_transformations ( $ relation ['post_id ' ], true );
11021110 foreach ( $ sizes as $ size => $ file_name ) {
11031111 $ local_url = path_join ( dirname ( $ base ), $ file_name );
11041112 if ( isset ( $ cached [ $ local_url ] ) ) {
11051113 $ aliases [ $ local_url ] = $ cached [ $ local_url ];
11061114 continue ;
11071115 }
11081116
1109- $ cloudinary_url = $ this ->media ->cloudinary_url ( $ relation ['post_id ' ], explode ( 'x ' , $ size ), $ relation [ ' transformations ' ] , $ public_id );
1117+ $ cloudinary_url = $ this ->media ->cloudinary_url ( $ relation ['post_id ' ], explode ( 'x ' , $ size ), $ merged_transformations , $ public_id );
11101118 // The asset is not ready. Carry on.
11111119 if ( empty ( $ cloudinary_url ) ) {
11121120 continue ;
@@ -1524,8 +1532,10 @@ public function parse_element( $element ) {
15241532 $ tag_element ['context ' ] = $ post_context ;
15251533 if ( ! empty ( $ this ->known [ $ url ] ) && ! empty ( $ this ->known [ $ url ]['public_id ' ] ) ) {
15261534 $ item = $ this ->known [ $ url ];
1527- if ( ! empty ( $ item ['transformations ' ] ) ) {
1528- $ tag_element ['transformations ' ] = $ this ->media ->get_transformations_from_string ( $ item ['transformations ' ], $ tag_element ['type ' ] );
1535+ // Get merged transformations including overlays.
1536+ $ merged_transformations = Relate::get_transformations ( $ item ['post_id ' ], true );
1537+ if ( ! empty ( $ merged_transformations ) ) {
1538+ $ tag_element ['transformations ' ] = $ this ->media ->get_transformations_from_string ( $ merged_transformations , $ tag_element ['type ' ] );
15291539 }
15301540 // Get the public ID and append the extension if it's missing.
15311541 $ public_id = $ item ['public_id ' ];
0 commit comments