Announcement

#1 2017-11-05 19:16:53

Hood_fr
Member
Salon de Provence
2017-11-05
7

Retrieving $COMMENT_IMG

Hello,

My name is Robin and I am using Piwigo for a while now, and I've started developing my own personal plugin but I am no expert at all in PHP & SQL... I managed to get some code working by looking at other plugins and Piwigo documentation, but then I am stuck on the following problem :

in my main.inc.php file, I have the following

handler add_event_handler('loc_begin_picture', 'mplg_picture_handler');

and then I define the associated function :

function mplg_picture_handler()
{
....
}

I want to retrieve in this function the string containing the description of the current picture, which is usually referred to as $COMMENT_IMG, or $picture['current']['comment'] but apparently these variables are not yet defined at this stage, and I don't have any idea how to get it.

Any advice would be welcome ! Sorry if the answer is obvious, once again I am no expert. Thanks

RM

Piwigo version: 2.9
PHP version: 7.0.24
MySQL version: 5.5.57
Piwigo URL: http://photos.daedalum.org

Last edited by Hood_fr (2017-11-05 19:21:06)

Offline

 

#2 2017-11-06 02:20:11

flop25
Piwigo Team
2006-07-06
6801

Re: Retrieving $COMMENT_IMG

Hello

nice to see someone "having fun" with creating an extension ^^ You remind me my first tries... which are still my way of coding :D

you have the page http://photos.daedalum.org/tools/triggers_list.php where every trigger are registered

i think you need
render_element_content     trigger_change     string $content, array $current_picture
since it seems to allow you to access to current_picture


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

 

#3 2017-11-06 23:36:38

Hood_fr
Member
Salon de Provence
2017-11-05
7

Re: Retrieving $COMMENT_IMG

Thank you very much flop25 for your hint, this is exactly what I was looking for ! Now I can retrieve the name and it all works fine. I didn't know about this trigger list by the way thanks for that too !!

Robin

Last edited by Hood_fr (2017-11-06 23:37:04)

Offline

 

#4 2017-11-28 19:18:41

Hood_fr
Member
Salon de Provence
2017-11-05
7

Re: Retrieving $COMMENT_IMG

Following this advice to use the render_element_content in my extension, I found out that it interacts badly with the RV Maps & Earth extension which also use the same trigger, although with a EVENT_HANDLER_PRIORITY_NEUTRAL-5 propriety.

I have added a lower priority to my handler (EVENT_HANDLER_PRIORITY_NEUTRAL-10), and now the maps is displaying correctly.

Residual problem is : the central part of the screen is not responsive anymore. Nothing happens when I click on the picture thumbnail, or on the form scrolling lists & buttons below the map. Header and Footer are OK though.

Example : https://photos.daedalum.org/picture.php … 60&map

Any help would be welcome

Thanks in advance

Last edited by Hood_fr (2017-11-28 19:19:59)

Offline

 

#5 2017-11-28 19:48:16

flop25
Piwigo Team
2006-07-06
6801

Re: Retrieving $COMMENT_IMG

I've just seen that you are French actually. So I recommend you to post in the French forum where more people will be able to answer you with more accuracy


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

 

#6 2017-11-28 20:16:23

Hood_fr
Member
Salon de Provence
2017-11-05
7

Re: Retrieving $COMMENT_IMG

Offline

 

Board footer

Powered by FluxBB

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