File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -364,11 +364,14 @@ public function filter_out_local( $content ) {
364364 $ new_tag = str_replace ( $ poster , $ cloudinary_url , $ new_tag );
365365 }
366366 }
367- $ image_meta = wp_get_attachment_metadata ( $ attachment_id );
368- $ image_meta ['file ' ] = pathinfo ( $ cloudinary_id , PATHINFO_FILENAME ) . '/ ' . pathinfo ( $ cloudinary_id , PATHINFO_BASENAME );
369- $ image_meta ['overwrite_transformations ' ] = $ overwrite_transformations ;
370- $ new_tag = wp_image_add_srcset_and_sizes ( $ new_tag , $ image_meta , $ attachment_id );
371- $ content = str_replace ( $ asset , $ new_tag , $ content );
367+ // Add srcset on front end.
368+ if ( ! is_admin () ) {
369+ $ image_meta = wp_get_attachment_metadata ( $ attachment_id );
370+ $ image_meta ['file ' ] = pathinfo ( $ cloudinary_id , PATHINFO_FILENAME ) . '/ ' . pathinfo ( $ cloudinary_id , PATHINFO_BASENAME );
371+ $ image_meta ['overwrite_transformations ' ] = $ overwrite_transformations ;
372+ $ new_tag = wp_image_add_srcset_and_sizes ( $ new_tag , $ image_meta , $ attachment_id );
373+ }
374+ $ content = str_replace ( $ asset , $ new_tag , $ content );
372375 }
373376
374377 return $ this ->filter_video_shortcodes ( $ content );
You can’t perform that action at this time.
0 commit comments