From beac4576ff7b7070dea102fccbe64083d4258a14 Mon Sep 17 00:00:00 2001 From: Branden DeVries Date: Tue, 22 Jan 2019 13:45:11 -0800 Subject: [PATCH] Additional Image Support in Write-RsCatalogItem --- .../Functions/CatalogItems/Write-RsCatalogItem.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ReportingServicesTools/Functions/CatalogItems/Write-RsCatalogItem.ps1 b/ReportingServicesTools/Functions/CatalogItems/Write-RsCatalogItem.ps1 index 667c5c0f..d31a8e86 100644 --- a/ReportingServicesTools/Functions/CatalogItems/Write-RsCatalogItem.ps1 +++ b/ReportingServicesTools/Functions/CatalogItems/Write-RsCatalogItem.ps1 @@ -122,11 +122,11 @@ function Write-RsCatalogItem ) -or ( $itemType -eq "Resource" -and - $item.Extension -notin ('.png', '.jpg', '.jpeg') + $item.Extension -notin ('.png', '.jpg', '.jpeg','.gif','.bmp') ) ) { - throw "Invalid item specified! You can only upload Report, DataSource, DataSet and jpg/png files using this command!" + throw "Invalid item specified! You can only upload Report, DataSource, DataSet and jpg/png/gif/bmp files using this command!" } if ($RsFolder -eq "/") @@ -231,6 +231,7 @@ function Write-RsCatalogItem #If it is a resource we need to save the extension so the file can be recognized $itemName = $item.Name $property.Name = 'MimeType' + <# if ($item.Extension -eq ".png") { $property.Value = 'image/png' @@ -239,6 +240,15 @@ function Write-RsCatalogItem { $property.Value = 'image/jpeg' } + #> + switch ($item.Extension) + { + '.png' {$property.Value = 'image/png'} + {$_ -in '.jpg','.jpeg'} {$property.Value = 'image/jpeg'} + '.gif' {$property.Value = 'image/gif'} + '.bmp' {$property.Value = 'image/bmp'} + Default {$property.Value = 'image/jpeg'} + } $errorMessageItemType = 'resource' } else