fireside68

fireside68

PhotoShuffle - Intelligent metadata generation and shuffling for image collections

Hello, I’m excited to introduce PhotoShuffle, a lightweight Elixir library designed for managing image collections with intelligent metadata generation. It’s built specifically for portfolio sites, galleries, and applications that need to turn a directory of files into a structured, randomized display.

Features

PhotoShuffle handles the “boring” parts of building a gallery by automating metadata:

  • :game_die: Intelligent Shuffling: Easily shuffle and select a specific number of images from your collections.

  • :memo: Smart Titles: Automatically generates human-readable titles from filenames (e.g., IMG_5366.jpg becomes “Professional Installation Project”).

  • :round_pushpin: Deterministic Locations: Uses path hashing to assign consistent locations to images from a configurable list, ensuring a photo doesn’t “move” cities every time you refresh the page.

  • :electric_plug: Pluggable File Systems: Built with a behavior-based design, making it easy to mock file system interactions in your tests using tools like Mox.

  • :high_voltage: Zero Runtime Dependencies: Keeps your project lean with no external runtime requirements.

Quick Start

You can process a directory and shuffle the results in just a few lines:

Elixir

# Process images from a directory with a specific category context
{:ok, images} = PhotoShuffle.process_images("/path/to/images", "Portfolio")

# Shuffle and select 6 random images 
selected = PhotoShuffle.shuffle_images(images, 6)

Usage in Phoenix LiveView

It integrates cleanly into a LiveView mount or handle_event:

Elixir

def mount(_params, _session, socket) do
  path = Application.app_dir(:my_app, "priv/static/images/gallery")
  {:ok, all_images} = PhotoShuffle.process_images(path, "Gallery")
  displayed_images = PhotoShuffle.shuffle_images(all_images, 8)
  
  {:ok, assign(socket, images: displayed_images, all_images: all_images)}
end

The Story Behind PhotoShuffle

The idea for PhotoShuffle emerged while building portfolio sites and photo galleries, specifically for contractors in the construction space. I found myself repeatedly writing the same logic to parse filenames, generate “fake-but-consistent” metadata like locations, and handle randomized layouts.

I wanted a way to point a library at a folder of images and get back a structured list of maps ready for a Phoenix template, without manually tagging every single file. By using deterministic hashing for locations and smart string parsing for titles, PhotoShuffle makes static image folders feel like a dynamic, managed database.

Hex: https://hex.pm/packages/photo_shuffle

GitHub:

https://github.com/unaffiliatedstudios/photo_shuffle

I’d love to hear your thoughts or any features you’d like to see added!

First Post!

fireside68

fireside68

For what it’s worth, I’m doing so under the space of my Elixir consultancy/firm/etc., Unaffiliated Studios.

Where Next?

Popular in Announcing Top

mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story <- Meeseeks.all(html, css("tr.athing")) do...
New
jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
oltarasenko
Dear Elixir community, After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
kip
Image is an image processing library for Elixir. It is based upon the fabulous vix library that provides a libvips wrapper for Elixir. I...
622 18934 194
New
RobertDober
Earmark is a pure-Elixir Markdown converter. It is intended to be used as a library (just call Earmark.as_html), but can also be used as...
239 12645 134
New
Flo0807
Hello everyone! I am excited to share our heart project Backpex with you. After building several Phoenix applications, we realized that...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New
marcuslankenau
I feel kind of stuck with the absence of a proper xml library for Elixir. Currently I use SweetXML which was ok for me more or less to pa...
New

Other popular topics Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement