@@ -232,18 +232,26 @@ angular.module("umbraco")
232
232
if ( typeof properties [ p ] . value !== "undefined" && properties [ p ] . value !== "" && properties [ p ] . value !== null ) {
233
233
//Found a fallback property value
234
234
console . log ( "fallback" , properties [ p ] )
235
- $scope . model . value . shareImage = properties [ p ] . value ;
235
+ $scope . model . value . shareImage = properties [ p ] ;
236
236
237
237
238
- if ( $scope . model . value . shareImage != null && $scope . model . value . shareImage . startsWith ( "umb://" ) ) {
238
+ if ( $scope . model . value . shareImage . view == "mediapicker" && $scope . model . value . shareImage . value != null && $scope . model . value . shareImage . value . startsWith ( "umb://" ) ) {
239
239
//The fallback is a media picker
240
+ entityResource . getById ( $scope . model . value . shareImage . value , "Media" )
241
+ . then ( function ( mediaEntity ) {
242
+ $scope . model . value . shareImageUrl = mediaEntity . metaData . MediaPath ;
243
+ } ) ;
244
+ } else if ( $scope . model . value . shareImage . view == "mediapicker3" && $scope . model . value . shareImage . value . length > 0 ) {
245
+ //The fallback is a media picker
246
+ $scope . model . value . shareImage = properties [ p ] . value [ 0 ] . mediaKey
240
247
entityResource . getById ( $scope . model . value . shareImage , "Media" )
241
248
. then ( function ( mediaEntity ) {
249
+ console . log ( mediaEntity ) ;
242
250
$scope . model . value . shareImageUrl = mediaEntity . metaData . MediaPath ;
243
251
} ) ;
244
- } else if ( $scope . model . value . shareImage . startsWith ( "/" ) ) {
252
+ } else if ( $scope . model . value . shareImage . value . startsWith ( "/" ) ) {
245
253
//Probably an upload field. Could be another random property too, so be careful
246
- $scope . model . value . shareImageUrl = $scope . model . value . shareImage ;
254
+ $scope . model . value . shareImageUrl = $scope . model . value . shareImage . value ;
247
255
} else {
248
256
//Not a property with a valid source image
249
257
$scope . model . value . shareImageUrl = null ;
0 commit comments