Page 1 of 2

imgram - html gallery in ksh

Posted: Wed Apr 24, 2024 11:12 am
by oracle
Image

https://automa.triapul.cz/imgram/

Download: https://automa.triapul.cz/imgram/imgram.tgz

tl;dr:

you need ksh, perl, sed, etc
optionally imagemagick.

place img.conf in ~/.config
of the user who will run it
and edit it appropriately

user running img needs rw permissions
to both $db and $wroot

usage:
$ img <image_file> [tag1] [tag2] [...]

$ img rebuild
- rebuilds entire gallery

$ img rss
- rebuilds rss feed

Re: imgram - html gallery in ksh

Posted: Wed Apr 24, 2024 7:54 pm
by 82mhz
Thanks for sharing!

I gave it a quick try on Linux, and I could add images without problems, but every time I did "index rebuild", all jpgs in the output directory wound up being 9 bytes in size, even though they were fine before.

Any idea why that could be?

Re: imgram - html gallery in ksh

Posted: Wed Apr 24, 2024 7:57 pm
by zero cool
You didn't put the images and everything in the same directory as the db file and all?

Re: imgram - html gallery in ksh

Posted: Wed Apr 24, 2024 11:41 pm
by oracle
82mhz wrote: Wed Apr 24, 2024 7:54 pm Thanks for sharing!

I gave it a quick try on Linux, and I could add images without problems, but every time I did "index rebuild", all jpgs in the output directory wound up being 9 bytes in size, even though they were fine before.

Any idea why that could be?
That is strange, because once the images are copied/converted into the target directory, they are not touched ever again, even during rebuilding.

What distribution is this on and did you encounter any errors?

Re: imgram - html gallery in ksh

Posted: Thu Apr 25, 2024 6:01 am
by 82mhz
I'm on Arch Linux.

When I run the rebuild, there are no errors:

Code: Select all

$ ./img.ksh rebuild
making page for tag no_context
for posts from 1 to 20
making page for tag all
for posts from 1 to 20
Adding an image afterwards gives this:

Code: Select all

$ ./img.ksh 287b00d261e257d410c1c31e7e885b0b.jpg 
file: 287b00d261e257d410c1c31e7e885b0b.jpg
ext: jpg
tags: no_context
id: aaicrz
root: /tmp/imgram
no_context
making page for tag all
for posts from 1 to 20
making page for tag no_context
for posts from 1 to 20
date: 1713966160: Datei oder Verzeichnis nicht gefunden
"Datei oder Verzeichnis nicht gefunden" means "File or directory not found".

If I have some time, I will look into it further, for now that was just quickly testing it out a bit...

Re: imgram - html gallery in ksh

Posted: Thu Apr 25, 2024 6:04 am
by 82mhz
Here's a before and after rebuild, you can see that the first file changes size:

Code: Select all

andreas@powerplant:/tmp/imgram$ ll
insgesamt 196K
-rw-r--r-- 1 andreas andreas 151K 24. Apr 15:42  aaicrz.jpg
-rw-r--r-- 1 andreas andreas  465 24. Apr 15:42  all
-rw-r--r-- 1 andreas andreas   11 24. Apr 15:42  alltags
-rw-r--r-- 1 andreas andreas   99 24. Apr 15:42  db
-rw-r--r-- 1 andreas andreas    0 24. Apr 15:42  djjsej.jpg
-rw-r--r-- 1 andreas andreas 1,5K 24. Apr 15:42  img.xml
-rw-r--r-- 1 andreas andreas 1,7K 24. Apr 15:42  index.html
-rw-r--r-- 1 andreas andreas  465 24. Apr 15:42  no_context
-rw-r--r-- 1 andreas andreas 1,8K 24. Apr 15:42  no_context.html
-rw-r--r-- 1 andreas andreas    0 24. Apr 15:42  nyayip.jpg
-rw-r--r-- 1 andreas andreas  465 24. Apr 15:42  rev
-rw-r--r-- 1 andreas andreas 1,1K 24. Apr 15:42  rss
-rw-r--r-- 1 andreas andreas 1,1K 24. Apr 15:42  tmp
-rw-r--r-- 1 andreas andreas   22 24. Apr 15:42  tmptags
-rw-r--r-- 1 andreas andreas    0 24. Apr 15:42 '*'
andreas@powerplant:/tmp/imgram$ ../img.ksh rebuild
making page for tag no_context
for posts from 1 to 20
making page for tag all
for posts from 1 to 20
andreas@powerplant:/tmp/imgram$ ll
insgesamt 40K
-rw-r--r-- 1 andreas andreas    0 25. Apr 08:02  aaicrz.jpg
-rw-r--r-- 1 andreas andreas  465 25. Apr 08:02  all
-rw-r--r-- 1 andreas andreas   11 25. Apr 08:02  alltags
-rw-r--r-- 1 andreas andreas   99 24. Apr 15:42  db
-rw-r--r-- 1 andreas andreas    0 25. Apr 08:02  djjsej.jpg
-rw-r--r-- 1 andreas andreas    0 25. Apr 08:02  img.xml
-rw-r--r-- 1 andreas andreas 1,7K 25. Apr 08:02  index.html
-rw-r--r-- 1 andreas andreas  465 25. Apr 08:02  no_context
-rw-r--r-- 1 andreas andreas 1,8K 25. Apr 08:02  no_context.html
-rw-r--r-- 1 andreas andreas    0 25. Apr 08:02  nyayip.jpg
-rw-r--r-- 1 andreas andreas  465 25. Apr 08:02  rev
-rw-r--r-- 1 andreas andreas 1,1K 24. Apr 15:42  rss
-rw-r--r-- 1 andreas andreas  488 25. Apr 08:02  tmp
-rw-r--r-- 1 andreas andreas   33 25. Apr 08:02  tmptags
-rw-r--r-- 1 andreas andreas    0 25. Apr 08:02 '*'

Re: imgram - html gallery in ksh

Posted: Thu Apr 25, 2024 11:35 am
by oracle
you have wroot set to the same directory as db, wroot is a directory on your webserver, db is a local dir where magic happens, do not put anything in there. the date issue is related to rss generation, redownload the program, I fixed it so it will work on linux

Re: imgram - html gallery in ksh

Posted: Thu Apr 25, 2024 2:10 pm
by 82mhz
Well that was my mistake then - thanks for pointing it out! And for adapting the script for us unworthy Linux users :D

It works great now!

Re: imgram - html gallery in ksh

Posted: Thu Apr 25, 2024 3:41 pm
by oracle
Superb, I'm glad.

If you go public with your gallery, I'd love to add it to an (not just) imgram feed of various users https://img.triapul.cz/sect.html

Re: imgram - html gallery in ksh

Posted: Fri Apr 26, 2024 8:49 am
by 82mhz
I think first I have to take up photography again... :?
But if I put up an image gallery, I'll let you know!