Zoph Setup and Use

Jump straight to the Bookworm FreedomBox Zoph instructions

Welcome to the Zoph Setup and Use Thread

I’m starting to use Zoph, and as I learn about it I’ll document it here. I intend this to eventually find its way to the FreedomBox manual, but this is going to be my workspace. I’m happy to share this thread with you.

Outline

Bookworm

The Bookworm thread will be related to the current stable release with Zoph 1.0.1-3. I’m working on these topics:

Installation

I’ll skip detail on installation. Just install from plinth and if there is any trouble you should post to Support where you will get some help.

Features and Functionality

“Zoph Organizes Photos.” If you import a photo in sideways orientation Zoph can rotate a photo by 90 or 180 degrees, but this appears to be the limit of image edit capability. , well, Zoph Doesn’t Edit Photos. So I can see there should be some discussion about what you can do with Zoph, and what you need to do with other tools outside of Zoph. I was hoping for a Google Photos replacement in Zoph, and in some ways it delivers, but not in every way. Users need to understand what they’re getting, what the limitations are, and what their work flow should look like to use Zoph happily.

Initial Setup

To use the features of Zoph there are things you’d want to set up before you begin importing photos. The power of Zoph appears to be in organizing photos using a rich variety of metadata. We’ll discuss metadata and how and why you’d create it. Ideally we’ll set up a basic set of attributes related to the first batch of photos we’ll import.

Importing Photos

We’ll work through importing photos using the Zoph web interface. If absolutely necessary we can cover the command line interface, but as I’m learning more I hope we won’t need it.

Preparation

Make your photos ready to import. Details such as photo orientation have to be addressed before you import your photo to Zoph.

Import

We’ll import single photos and groups of photos. We will leverage the features we’ve set up in advance to make best use of import tools.

Trixie (Debian Testing)

The next Debian release, Trixie, should come out later this year and looks to be Zoph version 1.0.1-4 now. If you are using Testing and want to share what’s new then I’ll encourage you to make a Trixie reply to this thread to contain all of the Zoph 1.0.1-4 and Trixie discussion. It won’t be long before we’re all using that.

3 Likes

@sunil, @nbenedek, @jvalleroy, @njoseph - this instruction has all the workarounds related to the Zoph issues I’ve raised this week.

Bookworm Instructions

This is the Debian Bookworm with Zoph 1.0.1-3 thread which applies to FreedomBox on Debian Stable as of December 2024.

Upstream Project

Their documentation is rather good. You’ll want to be reading this soon!

What can I expect from Zoph in FreedomBox Bookworm?

Zoph is a FreedomBox application that helps you store, organize, and share photos. Is it a replacement for the big photo website? Not completely and mainly for the lack of rich editing tools you will find in “free-as-in-beer” consumer sites or professional photography portal solutions. Zoph does offer good photo upload, download, sharing and organization capability which is “free-as-in-freedom.” It is worth a try, but at this point you’re going to have to have to do a little work. When you do these things you’ll find Zoph to be a reasonable option for what it does.

What about editing?

Zoph can rotate photos in increments of 90 degrees to get the orientation right. That’s about the end of editing with Zoph. There are many truly great free software options available for photo retouching with the most full-featured option probably being GIMP. Your editor won’t be integrated into the web service, but if you are willing adjust your edit/import workflow you won’t be missing much. With FreedomBox you could also work with file sharing tools such as Samba or NFS to work out an ‘edit in place,’ setup, but that is beyond the scope of this post. It’s possible for the intermediate to advanced Debian user. If that’s not you today - you will be if you get that sorted!

I’ve already tried Zoph, and I had a lot of trouble.

Me too. I’ve been slaving over this for days to figure it out - and I think it’s pretty close to right. That’s what I’m sharing here! Read on and try it again!

This is the robust way to set up Zoph!

We’re going through a number of steps here throug FreedomBox, then the command line, and finally in the Zoph web application.

Install and setup from the FreedomBox app page - but don’t start using it

  1. Install Zoph from the FreedomBox apps page normally. don’t hit the “Setup” button after installation yet.
  2. You’ll want to select your ordinary user account as the Zoph administrator before you hit the “Setup” button on the Zoph app management page in FreedomBox. I don’t believe it matters if this user is a FreedomBox system administrator.
  3. Stop! Don’t hit the “Launch web client” button or hit the Zoph application tab on the FreedomBox home page yet.

Now we’re going to do some work in the command line. You’ll want to use the Cockpit terminal or SSH to connect to your FreedomBox.

We are going to make some Zoph directories manually. The reason for this is that without some fine tuning you are going to run into a problem if you switch between the Zoph web application and the zoph command line tool. You should be able to use both, and we’ll get that right.

We are going to use sudo here, so you’ll need to be logged in as a FreedomBox administrative user. where you see a ‘$’, that is your command prompt and you will type in everything following the $, but not the $ itself. This will look somewhat like what you’ll see on your terminal.

  1. Create the directories you need, change owners and groups, set permissions

    $ cd /var/lib/zoph
    $ sudo mkdir mid thumb trash upload upload/mid upload/thumb
    $ sudo chown www-data:zoph mid thumb trash upload upload/mid upload/thumb
    $ sudo chmod 0770 mid thumb trash upload upload/mid upload/thumb
    $ sudo chmod g+s mid thumb trash upload upload/mid upload/thumb

  2. Add users www-data and any Zoph users to the zoph group

    $ sudo usermod -G zoph -a www-data
    $ sudo usermod -G zoph -a <zoph using FreedomBox account name>

    For my own user it looks like this: $ sudo usermod -G zoph -a joseph

That’s all of the command line work!

Now you can start the Zoph web application.

There are three parts to the Zoph tasks: configuration, first user setup, and then next user(s) setup. Last, we’ll create an album to put some pictures in.

Zoph Configuration

Go immediately to the admin menu and then configuration. We’re going to set a bunch of values in here. If I put something in bold, just do it that way. If it is not bold, you can experiment with different values later. Later you can read the manual about why I set things in bold.

  • Screen width: 92%
  • CLI user: Autodetect
  • Trash dir: trash
  • Resize parallel: Same as # of CPU cores. I have 2.
  • File mode: RW for user/collection… 0660
  • dir mode: RW for user/collection… 0770
  • CLI copy on import: Checked (for no confusion - read the manual on this)
  • Rotation: Checked
  • Rotate command: jpgegtran (other option is lossy, read the manual)
  • Salt for sharing full size images: Hit Generate
  • Salt for sharing mid size images: Hit Generate
  • Time format: H:i:s A
  • Hit the submit button at the bottom.

After you get comfortable with this you can do some experimentation. This is a good starting point. You may need to change time format based on your region - this is good for North America.

First User Setup

We’re going to be moving through a bunch of menus from the top menu bar here. Each page will have a submit/save/update type button to finalize your change. Click that before moving on to each section. Sometimes we go back and forth - there is a method to the madness.

people

You will see an unknown user. Edit that and fill out your name and any other fields you care to.

admin / users

Edit your username and set the person field selecting your name from the people record.

admin / groups

  • Make a group for your Zoph users, name it a"Zoph owners" for now - you can change its name later.
  • Edit the group and add your Zoph user as a Zoph owners member.

albums

Create an album named “user’s lightbox”. Do not grant any access to this album. (it’s in the manual) (also, substitute your username for user)

admin / users

Edit your user and set the lightbox album to the album you just made.

Your first user is set up! The rest is just details and learning to use the application.

Next user(s) setup

If you have more than one Zoph user you can consider this setup for the next users. In my case I want the other user to also be an administrator. Administrators are able to create albums, define people, set categories. It’s all practical stuff - so if more than one person is adding to your Zoph you’ll probably want to start this way. When you get to the point that you are creating User class users you are getting to be an expert.

people

Create a new person corresponding to your next user.

album

Create a new lightbox album for your next user.

admin / users

Create a new user

  • Zoph username must match the FreedomBox username exactly
  • Set the Person field for the user
  • Password must be empty
  • Set class to Admin
  • Set the lightbox field for the user
  • submit/save

admin / groups

Add your new user to the “Zoph owners” group you created.

Create an Album

Go to albums now and create a new photo album. Name it, “My new photo album.” You can change the name later. Hit the insert button. The window will change and you’ll see Album permissions. Select “Zoph owners” from the drop-down menu, keep access level 5, and make writable Yes.

We’re done!

You are now ready to import some photos and add them to My new photo album. I think this setup is complete enough to learn your way through Zoph smoothly. This will avoid some major headaches:

  1. Zoph does not delete photos. If you don’t set up trash I’m not sure how you’ll figure out what photos you can delete if your storage fills up. Trash makes that easier - just delete files from /var/lib/zoph/trash
  2. Zoph does not delete photos. So if you delete a photo from Zoph, and then try to import it again you will have an error and won’t be able to get that photo in Zoph again. trash fixes that, too.
  3. If you use command line and web interface to import photos it will start failing if you did not create the folders and set permissions as we did earlier.
  4. Zoph and FreedomBox don’t set up any users after the first. These instructions avoid a problem where you think you should be logged in, but are told that you gave the wrong user name or password.

I hope you’re able to work productively with Zoph after this! Here are some final thoughts as you get to using Zoph.

Use Hierarchies

It looks like hierarchy arrangements are going to be very useful. Let me give you some examples to get you thinking in this direction.

Places

You have a home, but you have probably had more than one home.

  • Make a place called Home, leave everything blank.
  • You can make a new place - “Childhood Home” with parent location of “Home”
  • You can make a new place - “Denver” with a parent location of “Home”
    • You can make an "Oak Street Apartment place with a parent of “Denver”
    • You can make a “First Avenue Apartment” place with a parent of “Denver”

Now when you organize and search you could search for Home for any home, Denver for any of your Denver apartments, or Oak Street Apartments for pictures from your epic party there.

Albums

I’m not sure if this is the best way, but it is what I’m doing.
I made an album named, “Photo Albums”. Under that we’ll create the rest of the photo albums that we’d like in any hierarchy arrangement. I did this because it looks like I can apply permissions to all of these at once. Maybe that will save some clicks. I did the same with lightboxes in a hierarchy.

Circles

Circles are groups of people which you’ll want to search for. “Family,” “School Friends,” “Softball Team.” I’m unsure if you can make circles of circles - I have not tried that yet. If so, it will probably be helpful:

  • Family
    • My Family
    • Cousins
    • Aunts and Uncles

Tell me how it works for you, and what you’re doing. I hope it’s great!

Installation

Install Zoph from the the FreedomBox apps page.
Still on the Zoph app page in plinth, and upon completion of installation, you’ll notice that you need to select a Zoph administrator user and click the “Setup” button. After setup completes you’ll see an option checkbox to use OpenStreeMap location service which is checked by default. If you’d like to geolocate your photos which contain EXIF data (GPS location from your phone or camera) then you will want this option set.

You are now ready to launch the Zoph web client and log in.

1 Like

Initial Setup

There are two topics in here. Zoph configuration changes from the default which I regard as urgent and user creation.

Configuration

Log in the first time and select the admin tab, and then config. There are a few things you’ll want to set up right away.

Screen Width

You can experiment here, but try setting width to 92%. The default is 1000px, but I feel better using a percentage given narrow phone screens and such. You may think 1080 is perfect because that is a common monitor width, but it’s not. 1000px is good on 1080p which is about 92%.

Paths / Trash dir - super important

You’ll want to define the trash folder first thing. Just put in the word trash. That will create a directory /var/lib/zoph/trash and move any file you delete in Zoph to this folder. If you reimport and redelete images it will name the trash files photo.jpg, photo_1.jpg, photo_2.jpg…

If you don’t do this, you will accumulate a bunch of files which are deleted from Zoph, but not deleted from disk, and interspersed among your Zoph photos and it will be super painful to clean up. Set up the trash. Do it now.

Rotation

I’ve been worried about this and happy to see something in here. Check rotation and maybe set the rotation command to ‘jpegtran’ which is lossless. The other option works for additional file types, but is lossy. Depending on your need for quality you may wish to avoid that.

You can try the lossy ‘convert’ function if you like and see how it goes. In either case your original image will be saved as orig_photo.jpg

Sharing / Salt values

You will be forced to do this when you set up the trash folder. Zoph will take you right to these configuration items when you try to save the trash change. Just hit the “generate” button on the right and Zoph will populate the item for you.

These are all the immediate config changes that I think are needed. On to users.

Create Users

FreedomBox will create one user for Zoph - and that will be the user that hits the ‘Setup’ button on the Zoph app management page in plinth. If you have other FreedomBox users that will be using Zoph you’ll have to create individual accounts for them from the Zoph app.

  • make their Zoph user name the same as the FreedomBox user name
  • leave the Zoph password field blank (this will use FreedomBox single-sign-on(“SSO”)).

I’m still trying to figure out permissions, so stand by for this.

these are my older notes, may don’t read past here.
look at admin user account

  • Person record is “Unknown Person”
    • Open the person record and edit that as Joseph.
    • Create a circle for family and add Joseph to the circle.
    • Create people for other family members and add them to the circle.
  • Create an album “Personal Lightbox” in album root
    • Create an album “Lightbox for Joseph” in Personal Lightbox
  • Create a place Home but do not define the metadata (I’ve had lots of homes…)
    • Create a place for my current home under Home. Will create past homes under Home as well…

Reference Links

Wikibook for an older version of Zoph, but this document basically does what I’m trying to do here.

Good first time use instruction in here from the Zoph team.

Importing a photo

Importing a photo is easy in Zoph, but there are some details that you’ll want to understand to be happy using Zoph. We’ll cover preparing a photo for import and then the importation.

Get prepared to import a photo

Manage your storage

When a photo is imported with Zoph it will not ever be deleted. When you “delete” a photo in the Zoph app it removes the poto from the user interface, but does not delete the photo from disk. For this reason you’ll want to curate your photos before you import them if you are interested in conserving storage. My first time around I just imported everything, all kinds of junk, pictures of receipts, a picture of my ear when it was sore so I could see it, 100 pictures of existing damage on a rental car when the camera was in burst mode. You know, that sort of stuff. Don’t import that.

At minimum, make sure a picture is of acceptable quality and is oriented correctly before you import it. You will have to figure out a workflow to keep yourself organized.

Suggested workflow

If you are going to import heaps of photos then it is going to be some work. You may want to try something like this…

  • Create two folders: one for all your pictures, and one for pictures acceptable for import.
  • Fill the first folder with copies of all images whether you want them in Zoph or not. (copies because we’re going to do some file deletions later).
    • Only put files in the first folders, no subdirectories!
    • Only put image files (.jpg, .png, etc.) in the first folder. No EXIF json files, no videos, nothing but image files.
  • Start examining photos and if it is one you like, move it to the second folder. Don’t copy the file there, because you’ll lose your place if you are going to import many photos.
    • I would examine the file in a photo editor so that if the orientation is sideways you can fix that beofre moving it to your to-be-imported folder.
  • Once you have a batch of good photos in the second folder you can import those.
1 Like

Zoph issues and improvements

These items will be communicated to the development team through Salsa.

Zoph user creation

When we install Zoph an initial Zoph administrator user is created inside the Zoph application. When another FreedomBox user tries to use Zoph they will get a “wrong password” error because there is no corresponding Zoph user for the second and subsequent users.

Improvement

  • Add a user role for Zoph which creates Zoph app user accounts corresponding to the FreedomBox user in the same fashion as the first Zoph administrator is created. This would be a check box in the FreedomBox user permissions section.
    • If the user permission is subsequently disabled we’ll need a graceful way to handle this on the Zoph application side.

Trash folder needs to be configured by FreedomBox

Zoph does not delete pictures. When a user imports a picture file, and then deletes the file through the UI the imported file remains in /var/lib/zoph but is then ignored by the application. If this happens by mistake and the user tries to import the file anew Zoph will have an error and refuse to clobber the existing file.

This can be improved by configuring a trash folder in Zoph (/var/lib/zoph/trash) whereupon a file deleted in Zoph is moved to the trash folder such that the same file could be imported a second time after deletion.

The FreedomBox Zoph app admin page could also have an “Empty Trash” button added to remove the files in the Zoph trash folder. This would help users manage storage effectively with Zoph.

2 Likes

What is Zoph and what can I do with it?

Users can upload, delete, and download photos (or other images) with Zoph. Being a multi-user system there are administrative and regular users which can be granted different roles and permissions.

A powerful feature of Zoph is the ability to create metadata for photos and then search and organize photos based on metadata. These metadata which are created by users include:

  • People which can be “tagged” in photos.
  • Circles of people such as “school friends,” family, etc.
  • Places - and places can be map searchable by OpenStreetMaps
    • GPS data in photos can locate photos on the map as well. A photo in your neighborhood but not in your home can still be labelled, “home.”
    • Places can be a hierarchy. Think of “home” containing your childhood home and your current home.
  • a 10 scale rating ( 1 = Close your eyes through 10 = Museum )
  • Photo metadata in the photo file (date, file size, camera type and settings)

Using all of this would allow complex searches such as “good photos of my mother at her home without flash on her birthday”

Moving on to the admin options you’ll see some other capabilities:

  • Define users and groups
  • Create customized pages and page sets for albums
  • Import GPS tracks from GPX format files
  • Backup photos from within Zoph
  • Rotate images with lossy rotation or lossless jpeg rotation
  • Optional directory structures (/var/lib/zoph/2024/10 for October 2024)
  • Watermark images
  • Share photos, even with non-users
  • Download multiple photos (“all photos of you…”) in a zip file
  • email photos
1 Like

Zoph Permissions

This is not fully tested yet.

I’ve been having some trouble understanding how permissions work on Zoph when there are multiple users. I’m starting to get it now and am going to try to explain it.

Let’s start with two rules…

Rule 1: A user gets the least restrictive permission to do a thing.

There are several permission levers available in Zoph, but before we get into these you need to understand how a resulting permission is granted. Whether I can see a picture, and whether I can edit a picture is determined by the highest applicable degree of permission. For example…

  • There is a picture in the “Beach” album, and I can write to the Beach album.
  • That same picture is also in the “Vacation” album, and I am not allowed to write or even see the Vacation album.
  • Because I have permission to the photo through “Beach”, I can interact with the photo (rate it, make a comment, rotate it…)
  • If I were to remove the photo from the Beach album, I would lose access to it because the other path to the photo through Vacation is not allowed for me.

Of all the permissions that apply to an object, the user gets the least restrictive (or highest degree of permission) granted however those grants were made.

Rule 2: it always looks like you can see all the photos (and other stuff).

Suppose that there are 1,000 photos imported into Zoph. Suppose also that I have access to 12 of these photos through permissions.

  • I will see 12 photos
  • Zoph will tell me that there are 12 photos in total
  • By design, I’m not supposed to see any indication of the other 988 photos or any other thing for which I don’t have permission. Not even as part of a count.

A user’s permission set creates that user’s view of the state and content of the Zoph application. Anything not permitted should not be seen or referred to. By design a user would not be able to infer the existence of anything outside of the user’s permission scope.

  • The Family Pictures album has the default access level of ‘5’.
  • The Bikini Models album has an access level of ‘6’.
  • The people who can see the Family Pictures album won’t see the Bikini Models album unless they are also in a group with access level 6.
  • The people who can see the Family Pictures album won’t see that there are another 10,000 photos in Bikini Models, either.

How do we really make this work?

Here’s my situation. My wife’s G**gle account is so full that she’s starting to have problems sending and receiving email. We investigated and find that almost all of her G**gle storage is consumed by pictures. Our plan is to migrate photos to Zoph to free up G**gle storage so she doesn’t have communication problems. (We could fix the G**gle email problem with FreedomBox too, but priorities…) So, here is what we need.

  1. She will need help from a Zoph administrator (that’s me).
  2. She will need to be able to import photos into Zoph.
  3. We will both need to be able to see the pictures in Zoph.
  4. We will want to organize these into Albums and such, this will be a big job.
  5. We don’t have a Bikini Models folder to worry about.

Our Zoph Permission Plan

  • We are not going to work with permission level and accept the default value of 5.
  • I created an ordinary user for my wife having the same action permissions as my account
  1. You may already object to “can share photos: No,” but I think we can work on the sharing features in the future. For now we’ll have access to the photos in Zoph and can share by email or other means, so I don’t worry about this yet.
  2. I created a group containing both of us.
  3. I created albums (albums can be a hierarchy which is why I go this way):
  • ‘Import’ at the top level which we can both edit.
  • ‘Albums’ at the top level which we can both edit.

New photos get uploaded and imported into ‘Import’. Import may be full of all kinds of junk until we get it sorted. Then we create an album we want under ‘Albums’ and can simultaneously add a photo to an album (Albums/Vacation) and remove the photo from Import. Now we’re getting organized! We’ll see how this goes.

Permission Details

This is a great starting reference for permissions. The specific actions allowed to a user are covered there. Groups and Albums are the key, however.

  • Create the user accounts you need.
  • Create groups that contain the users you need.
  • Create albums and give the groups write permission to the albums.
  • Albums can inherit permissions, so if you do this as a hierarchy you can save yourself the detail work.

Users: me (admin), she (user)
Group: Family with members me and she
Album: Albums Root / Albums
Albums Root / Albums Permission: Group Family can write.

Next we can create a photo album we want to use, say “Wedding Pictures”
Create album “Wedding Pictures” under “Albums”.
Wedding Pictures already has the right permissions inherited.
Search for photos taken around our wedding date - most are wedding pictures! Select them all, weed out a few exceptions, and put them all in “Wedding Pictures”. Ta-daa! Organized!

Let’s hope it really goes that well.

Importing Photos Details

I’m getting some experience importing lots of photos and want to share what I’m learning.

There is a batch size you’ll want to work within

  • I made a 50GB tar file and moved that into the upload folder. Zoph will unpack the archive, but will not, thankfully, move all this onto the import page of Zoph.
  • By trial and error I’ve found that batches of 150 photos work. When I try a thousand or several hundred the import page does not work.
  • I’m finding the web import to be less problematic than command line import. It seems like you can have some file permission issues if you mix CLI and web. Use the web function and it will be reliable. It is probably possible to fix the permission problems, but that will take a lot of analysis.
  • It is easier (fewer clicks) to delete a photo after upload and before import - if you hover over the uploaded picture you’ll get a preview that will help you see what is worth importing.

You can put heaps of images into a folder shared with Samba, and then select groups of about 150 from the web upload dialog. Then curate the photos from the import page where you can easily delete the bad photos. The import the remaining pictures and go on to the next batch of 150.

You have to control duplicate filenames.

Many cameras have overlapping filenames (DSCF01234.JPG). I have many different images with identical filenames that needed to be controlled. The approach I took was to make a script to rename every picture using mcookie to give a 128bit random hex string filename to work around filename contention. Zoph will not overwrite a photo when you try to import different pictures with the same filename. There are better ways to do this, but this does avoid filename collisions unless you are really unlucky.

I believe that you can create folders at import time which will reduce filename contention, but I have not tried this. When you have photos shared from many people with different cameras you can have a surprising amount of duplicated file names.

Wow, this thread is really incredible. You are pretty much a Zoph expert at this point. Would you mind putting the more important pieces of knowledge into the Manual, so that it is available in the “Learn more” help section of FreedomBox?

2 Likes

Thanks, I’ve been trying to get this fully usable for my users and it’s been a big job. My goal is to distill all of this for the manual once I feel like I’ve got everything sorted. I think I’m getting close.

1 Like

I am also starting with Zoph and find the manual difficult to follow. Thus thanks for your effort, it is well needed.
My main intention is to make an album available to the public, so without log-in. Did you find a way? The creation of a “default user” does not work for me.

I have not investigated that beyond reading the explanations in the config menus. Did you see that wikibook link? I haven’t read the whole thing, but it seemed like the author put a lot of effort into that. I’d look there if the project doco isn’t helpful.

Yes I followed these instructions. Instead of changing file config.inc.php by hand I set the default user in the config tab, which is described elsewhere.

Effect is that when trying to access Zoph I am prompted for the log in. Hitting cancel gives a “access denied”. Entering the default user (which I also added as Freedombox user), lets me enter Zoph and see my fotos. Interestingly, I am NOT logged in, because there is a login button active.
My guess is that the permission system of Freedombox forces me to enter the password before I can access Zoph. Then Zoph realizes I am using the default user and grants me “guest” access.

However, no need to investigate just for me. I am for now using Nextcloud with a public share of the folder and (because the automatically created link is very long) a subdomain with redirect to that link.

By the way, do you know why Zoph is still on version 1.0 in Debian, whereas it is actively developed upstream and has 1.4 already? I guess the latest version does not look so antique and probably is also easier to use (e.g. try to add a Person, hard to find).

Effect is that when trying to access Zoph I am prompted for the log in.

I believe there is something going on there and have made an issue for this. I’d expect that my own user would use FreedomBox SSO - but I get the login prompts (two of them).

As for the version - yes Debian appears far downrev and I don’t know why. I could see some non-free component of newer versions keep that out of the Debian distribution, but this is spectulation.