imgram - html gallery in ksh

one should not chase the electric dream
User avatar
oracle
Posts: 100
Joined: Fri Apr 19, 2024 9:50 am
Location: A pond

imgram - html gallery in ksh

Post 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
I am the DEADNET ORACLE. I AM NOT RELATED TO THE COMPANY CALLED ORACLE.
User avatar
82mhz
Posts: 67
Joined: Sat Apr 20, 2024 11:39 am
Location: Germany
IRC: _82mhz on libera
Mastodon: @82mhz@oldbytes.space
Contact:

Re: imgram - html gallery in ksh

Post 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?
User avatar
zero cool
Site Admin
Posts: 211
Joined: Fri Apr 19, 2024 9:40 am
Location: The sea of meatballs
Gopher: gopher.deadnet.se
IRC: Headcrash @ irc.libera.chat
Jabber: headcrash@og.im
Contact:

Re: imgram - html gallery in ksh

Post by zero cool »

You didn't put the images and everything in the same directory as the db file and all?
Everything is a smoke machine if you operate it wrong enough.
fsck.life
deadnet.se
User avatar
oracle
Posts: 100
Joined: Fri Apr 19, 2024 9:50 am
Location: A pond

Re: imgram - html gallery in ksh

Post 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?
I am the DEADNET ORACLE. I AM NOT RELATED TO THE COMPANY CALLED ORACLE.
User avatar
82mhz
Posts: 67
Joined: Sat Apr 20, 2024 11:39 am
Location: Germany
IRC: _82mhz on libera
Mastodon: @82mhz@oldbytes.space
Contact:

Re: imgram - html gallery in ksh

Post 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...
User avatar
82mhz
Posts: 67
Joined: Sat Apr 20, 2024 11:39 am
Location: Germany
IRC: _82mhz on libera
Mastodon: @82mhz@oldbytes.space
Contact:

Re: imgram - html gallery in ksh

Post 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 '*'
User avatar
oracle
Posts: 100
Joined: Fri Apr 19, 2024 9:50 am
Location: A pond

Re: imgram - html gallery in ksh

Post 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
I am the DEADNET ORACLE. I AM NOT RELATED TO THE COMPANY CALLED ORACLE.
User avatar
82mhz
Posts: 67
Joined: Sat Apr 20, 2024 11:39 am
Location: Germany
IRC: _82mhz on libera
Mastodon: @82mhz@oldbytes.space
Contact:

Re: imgram - html gallery in ksh

Post 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!
User avatar
oracle
Posts: 100
Joined: Fri Apr 19, 2024 9:50 am
Location: A pond

Re: imgram - html gallery in ksh

Post 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
I am the DEADNET ORACLE. I AM NOT RELATED TO THE COMPANY CALLED ORACLE.
User avatar
82mhz
Posts: 67
Joined: Sat Apr 20, 2024 11:39 am
Location: Germany
IRC: _82mhz on libera
Mastodon: @82mhz@oldbytes.space
Contact:

Re: imgram - html gallery in ksh

Post 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!
Post Reply