Lightbox script to output picture name and sizes


Topic: Lightbox script to output picture name and sizes

billywinter pro asked 5 years ago

I found the process of adding the picture sizes to the lightbox output script frustrating. I created this simple powershell script to automatically write the code. Just provide the folder where your pictures are and it will write out the code including the size and file name. Just paste it back in your lightbox implementation.

Clear-Host $imgloc = 'c:\public_html\pics\' $folder = 'pics' Set-Location -Path $imgloc $files = Get-ChildItem -Path $imgloc foreach ($file in $files) { if ($file.Extension -ne ".jpg") { continue } $hfile = (get-item $file) $img = [System.Drawing.Image]::Fromfile($hfile); $ih= $img.Size.Height $iw= $img.Size.width $imgsize = "$iw"+"x"+"$ih" '' }


Magdalena Dembna staff premium commented 5 years ago

Thanks for this solution, it will certainly be helpful to other users with a similar issue. Kind regards, Magdalena


billywinter pro commented 5 years ago

I wasnt able to post the whole script for some reason, trying again below:

Clear-Host

$imgloc = 'c:\users\public_html\pics\' $folder = 'pics' Set-Location -Path $imgloc

$files = Get-ChildItem -Path $imgloc $icnt = 0 foreach ($file in $files) { if ($file.Extension -ne ".jpg") { continue } $icnt++ $hfile = (get-item $file) $img = [System.Drawing.Image]::Fromfile($hfile); $ih= $img.Size.Height $iw= $img.Size.width $imgsize = "$iw"+"x"+"$ih" '' }


billywinter pro commented 5 years ago

Nope, didnt work for some reason this keeps getting cut off when I post: ''


billywinter pro commented 5 years ago

Nope, didnt work for some reason this keeps getting cut off when I post: ''


billywinter pro commented 5 years ago

Nope, didnt work for some reason this keeps getting cut off when I post: ''


Magdalena Dembna staff premium commented 5 years ago

Have you tried wrapping it in code syntax?


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: all
  • Browser: all
  • OS: windows
  • Provided sample code: No
  • Provided link: No