Testing Pictures


[UPDATE]

I've been refining my EXIF Library for .NET, and the blogging utilities I wrote in Powershell. Now I have Upload-BlogFile (on community server which hosts this blog it will only upload pictures) and NEW-blog post. Getting pictures which match some selection criteria, uploading them, building the HTML to display them (using the title in their EXIF data to caption them) and posting the HTML to my blog is all done in one line of Powershell It's a long line, but here it is. Split over 3 lines for readability

 dir E:\DCIM\102PENTX\Develops\*small* | ForEach-Object -Begin {[String]$myHtml=""} 

-Process {$myHtml += '<p><img src="' + (upload-blogfile $_.fullname) + '" /></p><p><b>' +  (get-image $_.fullname).title + '</b></p>'} 
-end {New-BlogPost -body $myHtml -Title "Testing Pictures"}

Shortly, I'll write a longer post explaining these and with the code available for download, but I LOVE this 3 block FOR {before loop} {loop} {after you've finished}. In VB etc it doesn't matter, but in a script it means you can keep the stuff you're doing the FOR for in one line, even some of it falls outside actual loop. I'm doubt if that's a PowerShell invention, but wherever it came from it's seems something akin to genius the first time you see it.  The results of the code are below the line.

Technorati Tags: Powershell


 

Frozen Sage

Frozen Sage 2