1

My wife wants to share a very large amount of old school photos with her friends.

Some of her friends suggested she use iCloud but I know that I can set up Apache and my home Internet connection to serve these photos - either with a static IP link or preferable with my own domain name. I will probably do that with my own domain name.

But it's the presentation of the page which I need help with.

I need some simple way where I can generate an HTML file which will show thumbnails on the page of each school picture, then the user can click on the picture to see it full size and download it.

There is no active content, no videos, no animations. It's just a single purpose webpage to host and share old school photos.

I remember many years ago there was a software package called "Netscape Communicator" and it would let you create a simple webpage as I described, but I can find nothing now in the repository which will help me.

Please suggest a solution which will let me complete the process.

Thank you, geo

Geo
  • 11

1 Answers1

1

A simple HTML file with a bunch of image thumbnails and links can be created fairly easily. Assuming:

  • The HTML file is the same directory as the images
  • The images all have some property which makes it easy to loop over them in the command line (all files with extension .jpg, for example).

    This makes it easier to create thumbnails for them. You should use thumbnails so that people don't download the entire set of images just by opening your page.

Adapting this post:

printf "%s\n" '<!DOCTYPE html><meta charset=utf-8><title>Images</title>' > images.html
mkdir thumbs
for i in *.jpg
do
    convert "$i" -thumbnail 100 "thumbs/$i"
    printf '<a href="%s"><img src="%s" alt="%s"></a>\n' "$i" "thumbs/$i" "$i"
done >> images.html

Now, images.html has the minimum valid HTML5 displaying a bunch of thumbnails and linking to the images of the thumbnails. Point your Apache instance to the directory and serve as needed.

You can probably try to make a table out of it or something, but this should be sufficient.

An example using the images from /usr/share/background:

$ head images.html
<!DOCTYPE html><meta charset=utf-8><title>Images</title>
<a href="160218-deux-two_by_Pierre_Cante.jpg"><img src="thumbs/160218-deux-two_by_Pierre_Cante.jpg" alt="160218-deux-two_by_Pierre_Cante.jpg"></a>
<a href="Black_hole_by_Marek_Koteluk.jpg"><img src="thumbs/Black_hole_by_Marek_Koteluk.jpg" alt="Black_hole_by_Marek_Koteluk.jpg"></a>
<a href="Cielo_estrellado_by_Eduardo_Diez_Viñuela.jpg"><img src="thumbs/Cielo_estrellado_by_Eduardo_Diez_Viñuela.jpg" alt="Cielo_estrellado_by_Eduardo_Diez_Viñuela.jpg"></a>
<a href="clock_by_Bernhard_Hanakam.jpg"><img src="thumbs/clock_by_Bernhard_Hanakam.jpg" alt="clock_by_Bernhard_Hanakam.jpg"></a>
<a href="Dans_ma_bulle_by_Christophe_Weibel.jpg"><img src="thumbs/Dans_ma_bulle_by_Christophe_Weibel.jpg" alt="Dans_ma_bulle_by_Christophe_Weibel.jpg"></a>
<a href="Flora_by_Marek_Koteluk.jpg"><img src="thumbs/Flora_by_Marek_Koteluk.jpg" alt="Flora_by_Marek_Koteluk.jpg"></a>
<a href="Icy_Grass_by_Raymond_Lavoie.jpg"><img src="thumbs/Icy_Grass_by_Raymond_Lavoie.jpg" alt="Icy_Grass_by_Raymond_Lavoie.jpg"></a>
<a href="Night_lights_by_Alberto_Salvia_Novella.jpg"><img src="thumbs/Night_lights_by_Alberto_Salvia_Novella.jpg" alt="Night_lights_by_Alberto_Salvia_Novella.jpg"></a>
<a href="passion_flower_by_Irene_Gr.jpg"><img src="thumbs/passion_flower_by_Irene_Gr.jpg" alt="passion_flower_by_Irene_Gr.jpg"></a>

enter image description here

muru
  • 197,895
  • 55
  • 485
  • 740
  • Nice bash solution! – derHugo Jul 18 '17 at 06:28
  • That was extremely elegant! I didn't know the operating system itself could generate the thumbnails and write the HTML file. I'm trying to add a few words to the HTML file, such as a basic title, decade in which the photos were taken and where. I'm trying to use a program called "Bluefish" to edit the HTML file to insert a title for the viewer to observe but am having no luck. The title seems to mess up the layout of the thumbnails. – Geo Jul 19 '17 at 19:07
  • Thank you for your help, I got everything running and got my domain name registered so now my wife's old school photos can be shared with her old classmates even if they're across the country. – Geo Jul 20 '17 at 03:31
  • @Geo did you solve the title problem? – muru Jul 20 '17 at 03:42
  • Yes, I figured it out. It's been a long while since I toyed around with this kind of stuff so I had to relearn it a bit. – Geo Jul 21 '17 at 12:01