1

I would like to be able to create an HTML image gallery in Windows 10 with a "1-click" approach. Is there a way to do that without having to install any software?

fixer1234
  • 27,064
  • 61
  • 75
  • 116
mk117
  • 1,755
  • 8
  • 23
  • 30
  • Voting to reopen. In the review queue, it wasn't clear this was a self-answered question. Otherwise, it seemed too broad of a request for this site, but since the answer was supplied, this is a useful question in my opinion. – Excellll Sep 17 '15 at 19:08

1 Answers1

2

Here's my answer to the question...

Created this batch script that utilizes online CDN sources for Colorbox & jQuery.

Sources for the cdn included: cdn.bootcss.com, ajax.googleapis.com, and cdnjs.cloudflare.com.

This script mainly takes all the jpg images (from the folder it's placed in), and creates a gallery from it. Basically if you require to display an image gallery with responsive (mobile-friendly) lightbox, then this batch script creates it.

@echo off
setlocal enableDelayedExpansion
set "file_start=<HTML><HEAD><title>Gallery</title><meta name="viewport" content="width=device-width, initial-scale=1"><link href="https://cdn.bootcss.com/jquery.colorbox/1.4.33/example1/colorbox.min.css" media="all" rel="stylesheet" /><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" type="text/javascript"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.colorbox/1.6.3/jquery.colorbox-min.js" type="text/javascript"></script><script>$(document).ready(function(){ $('a.lightbox').colorbox({rel:'images', maxWidth: '90%%', maxHeight: '90%%' }); });</script></HEAD><BODY>"
set "link_start=<a href=""
set ^"image_start=" class="lightbox"><img rel="images" src=""
set ^"link_end=" width="30%%"/></a> "
set "file_end=</BODY></HTML>"
set "file_name=image_gallery.html"

>"%file_name%" (
  echo !file_start!
  setlocal disableDelayedExpansion
  for %%I in (*.jpg) do (
    set "image=%%~fI"
    setlocal enableDelayedExpansion
    echo !link_start!!image!!image_start!!image!!link_end!
    endlocal
  )
  endlocal
  echo !file_end!
)
mk117
  • 1,755
  • 8
  • 23
  • 30