concat(
'data:image/',
if(
equals(toLower(last(split(outputs('Ottieni_metadati_file_CLP1')?['body/Name'],'.'))),'png'),
'png',
'jpeg'
),
';base64,',
base64(body('Ottieni_contenuto_file_CLP1'))
)
concat
expression. Even though your file is a .jpg
, the expression:last(split(outputs('Ottieni_metadati_file_CLP1')?['body/Name'], '.'))
only extracts the file extension, which might not always match the actual MIME type required by the "Populate a Microsoft Word Template" action.
Instead of relying on the file extension, explicitly set the MIME type to ensure it's either image/jpeg
or image/png
.
Try modifying your Compose
expression like this:
concat('data:image/jpeg;base64,', base64(body('Ottieni_contenuto_file_CLP1')))
Or, if you're sure the file is a PNG:
concat('data:image/png;base64,', base64(body('Ottieni_contenuto_file_CLP1')))
image/jpeg
or image/png
explicitly avoids issues with incorrect or unsupported types like image/jpg
(which is technically not a standard MIME type).