55#if NETCOREAPP
66using Umbraco . Cms . Core . Models ;
77using Umbraco . Cms . Core . Models . PublishedContent ;
8+ using Umbraco . Extensions ;
89#else
910using Umbraco . Core . Models ;
1011using Umbraco . Core . Models . PublishedContent ;
12+ using Umbraco . Web ;
1113#endif
1214
1315namespace Umbraco . Cms . Integrations . Automation . Zapier . Extensions
@@ -33,7 +35,10 @@ public static Dictionary<string, string> ToContentTypeDictionary(this IContentTy
3335
3436 var contentProperty = content . Properties . First ( p => p . Alias == propertyType . Alias ) ;
3537
36- contentDict . Add ( propertyType . Alias , contentProperty . GetValue ( ) . ToString ( ) ) ;
38+ if ( IsMedia ( contentProperty , out string url ) )
39+ contentDict . Add ( propertyType . Alias , url ) ;
40+ else
41+ contentDict . Add ( propertyType . Alias , contentProperty . GetValue ( ) . ToString ( ) ) ;
3742 }
3843
3944 return contentDict ;
@@ -55,5 +60,23 @@ public static Dictionary<string, string> ToContentDictionary(this IContent conte
5560
5661 return contentDict ;
5762 }
63+
64+ private static bool IsMedia ( IPublishedProperty contentProperty , out string url )
65+ {
66+ switch ( contentProperty . PropertyType . EditorAlias )
67+ {
68+ case Core . Constants . PropertyEditors . Aliases . MediaPicker :
69+ var mediaPickerValue = contentProperty . GetValue ( ) as IPublishedContent ;
70+ url = mediaPickerValue . Url ( ) ;
71+ return true ;
72+ case Core . Constants . PropertyEditors . Aliases . MediaPicker3 :
73+ var mediaPicker3Value = contentProperty . GetValue ( ) as MediaWithCrops ;
74+ url = mediaPicker3Value . LocalCrops . Src ;
75+ return true ;
76+ default :
77+ url = string . Empty ;
78+ return false ;
79+ }
80+ }
5881 }
5982}
0 commit comments