Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: update another table when uploading a picture  (Read 27831 times)

0 Members and 1 Guest are viewing this topic.

buddy0815

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
update another table when uploading a picture
« on: March 19, 2011, 07:02:13 pm »

Hi guys,

I would like to implement a little modification in cpg. Everytime the cpg15x_pictures table is changing (e.g. when uploading a new pictures) I would like to update another table in the same database. The coding shouldn't be the problem. But I need help to find the right places in the php files.

Where do I have to place my table update lines. In the upload.php and update.php? If so, where exactly in those files?

Thanks in advance

Regards
Logged

Nibbler

  • Guest
Re: update another table when uploading a picture
« Reply #1 on: March 19, 2011, 07:18:11 pm »

Best way would be to make a plugin using the add_file_data_success action. You could also use a database trigger. If you must edit the code directly then it's include/picmgmt.inc.php, add_picture function.
Logged

buddy0815

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: update another table when uploading a picture
« Reply #2 on: March 19, 2011, 08:05:38 pm »

thanks a lot. this leeds me to some further questions

1. is the add_picture function in include/picmgmt.inc.php just executed when adding a file or is it also executed when you change attributes from an existing image?
2. do you have a how-to link where I can see how to make a plugin with the add-file_data_success action?
3. where can I found more infos about the database trigger?

Thanks in advance!

Regards
Logged

Nibbler

  • Guest
Re: update another table when uploading a picture
« Reply #3 on: March 19, 2011, 08:08:51 pm »

1. New files only.
2. We don't have tutorials for all possible actions. Plugin docs are at http://documentation.coppermine-gallery.net/en/dev_plugins.htm
3. http://dev.mysql.com/doc/refman/5.1/en/triggers.html
Logged

buddy0815

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: update another table when uploading a picture
« Reply #4 on: March 19, 2011, 09:26:49 pm »

thanks for your quick answer. I read the provided link about the trigger and it sounds fascinating!!! haven't heard that before. I will try that and report my experience after that.. thanks a lot! sounds to be exactly what I was locking for.
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.