Generating Gallery XML File from Images

/ Published in: Windows PowerShell
Save to your folder(s)

Copy this code and paste it in your HTML
  1. param ($path, $urlpath)
  2. $files = Get-ChildItem -path $path -filter *.jpg | Select-Object Name
  3. Write-Output "<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes""?>"
  4. Write-Output "<images>"
  5. foreach ($file in $files)
  6. {
  7. $n = $file.Name
  8. "<pic><image>$urlpath/$n</image><thumbnail>$urlpath/thumbs/$n</thumbnail><caption>$n</caption></pic>"
  9. }
  10. Write-Output "</images>"

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.