summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken@jots.org>2026-06-18 23:00:17 +0000
committerKen D'Ambrosio <ken@jots.org>2026-06-18 23:00:17 +0000
commit6f975533f075cc761184b5a7392522264eca6fc1 (patch)
tree33b1f8678d34331a5b9b6a358ca688467263ec0b /views
parentfaec9c5448dfe3bbb7e187c7fb4d58557b70035d (diff)
Add per-photo rotate-left/right widget to admin edit pageHEADmain
Many older photos (especially pre-EXIF-orientation cameras) are off by a multiple of 90 degrees with no metadata to auto-correct. Each image row in the admin file table now has rotate buttons that physically rotate the file (auto-orienting first to normalize any existing EXIF tag), swap the stored width/height, and clear the cached thumbnail so it regenerates from the corrected image. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'views')
-rw-r--r--views/admin/album.erb11
1 files changed, 11 insertions, 0 deletions
diff --git a/views/admin/album.erb b/views/admin/album.erb
index 8c9ebe1..d1b8cb8 100644
--- a/views/admin/album.erb
+++ b/views/admin/album.erb
@@ -63,6 +63,7 @@
<th>Caption</th>
<th>Visible</th>
<th>Cover</th>
+ <th>Rotate</th>
<th>Delete</th>
</tr>
</thead>
@@ -70,6 +71,7 @@
<% @files.each do |name| %>
<% meta = (@data['files'] || {})[name] || {} %>
<% file_rel = @rel.empty? ? name : "#{@rel}/#{name}" %>
+ <% is_image = IMAGE_EXTS.include?(File.extname(name).downcase.delete_prefix('.')) %>
<tr<%= ' class="original-file"' if meta['transcoded_to'] %>>
<td><img src="/thumb/<%= file_rel %>" width="60" height="60" loading="lazy" style="object-fit:cover"></td>
<td class="filename">
@@ -84,6 +86,15 @@
<td class="cover-cell">
<input type="radio" name="album_cover_file" value="<%= name %>" class="cover-radio"<%= ' checked' if @data['cover'] == name %>>
</td>
+ <td class="rotate-cell">
+ <% if is_image %>
+ <form method="post" action="/admin/rotate/<%= @rel %>" class="rotate-form">
+ <input type="hidden" name="file" value="<%= ERB::Util.html_escape(name) %>">
+ <button type="submit" name="dir" value="left" class="btn btn-sm" title="Rotate left">⟲</button>
+ <button type="submit" name="dir" value="right" class="btn btn-sm" title="Rotate right">⟳</button>
+ </form>
+ <% end %>
+ </td>
<td class="delete-cell">
<input type="checkbox" name="file_delete[<%= name %>]" value="1" class="delete-check">
</td>