I'm using photo added by plugin (+ community) to create a shared album. I would like the user name displayed everywhere the image title is displayed (whether in thumbnail display or photo page)
Is there any way to achieve this? I'm new to Piwigo and Smarty templating... so it's getting confusing.
In short, anywhere we see:
Photo Name.jpg
I would like it to display:
Photo Name.jpg by Username
Can this be done?
Offline
Hi - thanks for the reply. I already am, but that only gives the option to add the info to the single photo page information. I would like to append that information to the photo title EVERYWHERE it is displayed -- especially on the thumbnail page so users can quickly see who uploaded a given photo in the thumbnail list...
Thanks
Hi :-)
you can test [extension by ddtddt] See photos by user
Offline
Hi ddtddt,
I am using that plugin as well (both are great, thanks!) but I don't see an option to append the user name to the photo title... Especially in the thumbnail view so we have:
---------- ------------- ------------
| | | | | |
| | | | | |
| | | | | |
---------- ------------- ------------
img1.jpg img2.jpg img3.jpg
by user1 by User1 by Johndoe
Thanks
... I could see this working 2 ways:
1) Add the "by User" info during display
-or-
2) Append "by User" to the actual filename during upload... (but that might mess up some programs that use filenames to sync...)
Option 2 might be dangerous... nevermind... I just need option 1:
Is there a way to add a filter to the "foto title display" that adds "uploaded by" on the end?
I too would like this. Is there not a simple "Title" filter that can add "uploaded by" to the end of the "title" text?
Something along the lines of:
<?php
by_title_filter($title){
$uploaded_by = get_uploaded_by($photoid);
$title =. " by " . $uploaded_by;
return $title;
}
add_filter(title, by_title_filter);
?>
(Note: above is based loosely on WordPress syntax... and does not work)
Current Solution:
1: Enable "LocalFiles Editor" Plugin
2: Add the following to Local Config tab:
/* Function to Add Uploaded By to photo name * by Monster_Danau: http://piwigo.org/forum/viewtopic.php?id=23592 * * Note: Also must modify core functions_html.inc.php line ~586 ( render_element_name() ): * * return trigger_event('render_element_name', $info['name']) . " by: " . my_get_upload_by($info['id']) ; */ function my_get_upload_by($id){ global $conf; $query = ' select '.$conf['user_fields']['username'].' AS username FROM ' . USERS_TABLE . ' WHERE '.$conf['user_fields']['id'].' = (select added_by FROM ' . IMAGES_TABLE . ' WHERE id = \''.$id.'\') ;'; $result = pwg_query($query); $row = pwg_db_fetch_assoc($result); $pab=$row['username']; return $pab; }
3. Edit the core file as indicated in the comments above.
4. For bonus points -- if you are using gthumb -- add the following to the CSS tab under local/css/rules.css :
#thumbnails .gthumb .thumbLegend { bottom:-68px; height: auto; }
This will make the new extended names fit nicer in the grid.
Hi :-)
Thanks Monster_Danau :-)
Why you don't make a plugin ;-)
Offline
There is a trigger render you should use because editing core files is NOT a solution
ddtddt hasn't see that detail I think
Offline
In fact the template option is the best one. Using prefilters is even better
Offline
flop25: Can you point me somewhere that shows how to hook into that trigger (or use a template / prefilter option even)?