I am using the web upload form on my Piwigo instance, and want to change the album that the site defaults to for uploads. The way I manage things, I upload all of my photos into a private album initially, and then after I add all of the various metadata, only then do I place the photos into public albums for display. Currently, the uploader defaults to a random public album, requiring that I change it to the desired album every single time. This gets annoying. I suspect that there is probably a setting for this somewhere, but I don't know where to find it.
Environment details:
Piwigo 15.7.0
Installed on 12 July 2024, 1 year 4 months 3 days ago
Operating system: Linux
PHP: 8.2.28 (Show info) [2025-11-16 00:00:25]
MySQL: 8.0.41-0ubuntu0.22.04.1 [2025-11-16 00:00:25]
Graphics Library: ImageMagick ImageMagick 6.9.11-60
Cache size 29631.78 Mo calculated 8 minutes ago
Piwigo URL: https://www.benschumin.com/
Offline
I don't know if there is a configuration flag for this but if there is a query string "album" set with the desired ID that will be used in the form, e.g. "/admin.php?page=photos_add&album=2". I suppose you could bookmark that somewhere.
Otherwise there is a trigger ('loc_end_photo_add_direct') in the code that would allow overriding the album that Piwigo has selected using the Local Files Editor and the personal plugin. (I did test this code on my install but I am running 16.0.0RC2.)
add_event_handler('loc_end_photo_add_direct', 'personal_force_selected_album');
function personal_force_selected_album()
{
global $template;
$always_use_album = 2; // set fixed album ID here
if (!isset($_GET['album'])) // skip the reset if album query string exists
{
$query = '
SELECT id, uppercats
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$always_use_album.'
;';
$result = pwg_query($query);
if (pwg_db_num_rows($result) == 1)
{
$selected_category = (string)$always_use_album;
$cat = pwg_db_fetch_assoc($result);
$template->assign('ADD_TO_ALBUM', get_cat_display_name_cache($cat['uppercats'], null));
$template->assign('selected_category', $selected_category);
}
}
}Offline
Ben, I do not understand how you meet this issue. How do you upload photos ?
When I want to upload photos to an album, I can do 1 of 2 actions :
1 - I open the album on public side and using the admin tools bar, I click on add photo. Even if this album is private, it should be visible to the webmaster.
2 - I open the administration, go to the album section, where I will have put the chosen album on top (always the same, according to your way of uploading) and click on the icon to add photos for this album.
Offline
moberley wrote:
I don't know if there is a configuration flag for this but if there is a query string "album" set with the desired ID that will be used in the form, e.g. "/admin.php?page=photos_add&album=2". I suppose you could bookmark that somewhere.
That worked perfectly. I have bookmarked this. Thank you!
Offline
Katryne wrote:
Ben, I do not understand how you meet this issue. How do you upload photos ?
I was using the add function underneath the "Photos" header on the sidebar in the admin section. There, it chooses whatever album it wants. I think that I'm going to start doing it your way, going in through the albums and adding it that way, since that selects the correct album right out of the gate.
Offline