Announcement

#1 2014-03-30 08:26:50

Monster_Danau
Guest

Append "photo added by" info to every photo title

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?

 

#2 2014-03-30 09:28:15

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13192

Re: Append "photo added by" info to every photo title

Offline

 

#3 2014-03-30 09:36:44

Monster_Danau
Guest

Re: Append "photo added by" info to every photo title

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

 

#4 2014-03-30 09:52:14

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
6759

Re: Append "photo added by" info to every photo title


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#5 2014-03-30 10:09:40

Monster_Danau
Guest

Re: Append "photo added by" info to every photo title

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

 

#6 2014-03-30 11:35:18

Monster_Danau
Guest

Re: Append "photo added by" info to every photo title

... 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...)

 

#7 2014-03-30 11:47:05

Monster_Danau
Guest

Re: Append "photo added by" info to every photo title

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?

 

#8 2014-03-31 04:46:38

Guru
Guest

Re: Append "photo added by" info to every photo title

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)

 

#9 2014-04-08 11:47:51

Monster_Danau
Guest

Re: Append "photo added by" info to every photo title

Current Solution:

1: Enable "LocalFiles Editor" Plugin

2: Add the following to Local Config tab:

Code:

/* 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 :

Code:

#thumbnails .gthumb .thumbLegend {
  bottom:-68px;
  height: auto;
}

This will make the new extended names fit nicer in the grid.

 

#10 2014-04-08 12:02:54

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
6759

Re: Append "photo added by" info to every photo title

Hi :-)

Thanks Monster_Danau :-)

Why you don't make a plugin ;-)


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#11 2014-04-08 18:24:05

flop25
Piwigo Team
2006-07-06
6932

Re: Append "photo added by" info to every photo title

There is a trigger render you should use because editing core files is NOT a solution
ddtddt hasn't see that detail I think


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#12 2014-04-08 18:27:12

flop25
Piwigo Team
2006-07-06
6932

Re: Append "photo added by" info to every photo title

In fact the template option is the best one. Using prefilters is even better


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#13 2014-04-09 07:42:40

Monster_Danau
Guest

Re: Append "photo added by" info to every photo title

flop25: Can you point me somewhere that shows how to hook into that trigger (or use a template / prefilter option even)?

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2019 · Contact