PSAppDeployToolkit
PSAppDeployToolkit copied to clipboard
[Feature] Add option to define logos as base64 encoded string
Summary of the new feature / enhancement
To avoid any copy jobs of corporate logos, I would need the possibility to define logos as a base64 image in the admx templates/config. In order to provide backwards combability both methods should work.
Proposed technical implementation details (optional)
If the logic behind the scene is PowerShell, I would suggest the following approach:
try {
$ImageFile = Get-ItemPropertyValue -LiteralPath "HKLM:SOFTWARE\Policies\PSAppDeployToolkit\Config\Assets" -Name "Logo"
If ($ImageFile -match "(^[A-Za-z]\:)|(^\\)" ){
$base64ImageString = [convert]::ToBase64String((get-content $ImageFile -encoding byte))
$imageBytes = [Convert]::FromBase64String($base64ImageString)
$ms = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length)
$ms.Write($imageBytes, 0, $imageBytes.Length);
$Image = [System.Drawing.Image]::FromStream($ms, $true)
}
else {
$base64ImageString = $ImageFile
$imageBytes = [Convert]::FromBase64String($base64ImageString)
$ms = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length)
$ms.Write($imageBytes, 0, $imageBytes.Length);
$Image = [System.Drawing.Image]::FromStream($ms, $true)
}
}
catch {
Write-Host "No image set via policy or invalid"
#Do some other stuff
}
What a brilliant idea! We'll have this in 4.2.0.