Skip to content

Instantly share code, notes, and snippets.

@jjulian
Created October 13, 2020 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjulian/7642b6121d30cb81d7edd812d7645878 to your computer and use it in GitHub Desktop.
Save jjulian/7642b6121d30cb81d7edd812d7645878 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'erb'
source_dir = ARGV[0]
files = Dir.entries(source_dir).map do |fname|
fname =~ /\.png$/ ? fname : nil
end.compact.sort
image_template = '<a href="<%= fname %>"><img src="<%= fname %>" width="300"/></a>'
renderer = ERB.new(image_template)
files.each do |fname|
puts renderer.result(binding)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment