forum.coppermine-gallery.net

Support => cpg1.4 plugins => cpg1.4.x Support => Older/other versions => cpg1.4 plugin contributions => Topic started by: Αndré on April 27, 2009, 08:45:39 am

Title: Add all pictures/files from a particular album to your favorites
Post by: Αndré on April 27, 2009, 08:45:39 am
Because a user asked (http://forum.coppermine-gallery.net/index.php/topic,59192.0.html) in the german support board, if there exists a plugin that can add all pictures from an album to your favorites, I created this small plugin.

It adds a star icon to the thumbnail view title row (next to the album name). When you click on that star, all files of the current album are added to your favorites.


[Edit GauGau 2010-03-03]
This plugin has been added to the subversion repository: http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.4.x/plugins/album_addfav

It has been updated as well to reflect the version checking routines in the plugin manager that are meant to make sure that galleries don't break because of plugins installed that aren't meant for that particular version of the gallery.

Download: https://sourceforge.net/projects/coppermine/files/Plugins/1.4.x/cpg1.4.x_plugin_album-addfav_v1.2.zip/download
[/Edit]
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Joachim Müller on April 27, 2009, 10:46:02 am
Nice one - created a corresponding record on the plugins page (http://coppermine-gallery.net/plugins.php) and added the file to the downloads section at sf.net.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Jens_LA on April 28, 2009, 06:39:27 pm
Hi,
i've got a little problem with downloading larger zip files (e.g. flv videos). I'd like to custumize the plugin to add only jpg's files to the favourites.
eenemeenemuu already explained that the according code line in album_addfav.php is:
Code: [Select]
$result = cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$_GET['album']}");
How do i exactly have to modify the code line to only add jpg files to the favourites?

Thanks a lot!

Jens
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on April 28, 2009, 07:13:50 pm
In album_addfav.php, change
Code: [Select]
$result = cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$_GET['album']}");to
Code: [Select]
$result = cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$_GET['album']} AND filename LIKE '%.jpg'");
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Deus on May 13, 2009, 03:18:47 am
eenemeenemuu I cant see any stars, can you post a screenshot of where the star is supposed to appear please?
Also, it's not dependent on a certain theme is it?

Thank you,
Darron.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on May 13, 2009, 08:19:21 am
Please review my first post. There is a screenshot and version 1.1 attached.

If it still doesn't work for your theme, please post a link to your gallery.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: benidorm365 on May 13, 2009, 08:47:27 pm
i have the same problem....ive installed the plugin, but nothing has come up

can someone please tell me what im doing wrong!!
my website is....
www.benidorm365.com

thanks
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on May 13, 2009, 09:19:03 pm
The plugin searches for the string:
Code: [Select]
<td width="100%" class="statlink">*</td>(which encloses be the album name as seen in the screenshot) and add the star behind the album name.

Also, it's not dependent on a certain theme is it?
my website is....
www.benidorm365.com
It works for at least all standard themes. If I should work with your custom theme, I need access to the thumbnail page to have a look of the html output.

Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Deus on May 14, 2009, 02:35:55 am
it worked this time, thank you.
Although I did have to create an album in plugins called /album_addfav and copy all the plugin files into there.

 ;D
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on May 14, 2009, 06:37:50 am
Although I did have to create an album in plugins called /album_addfav and copy all the plugin files into there.
Sorry, my fault. Plugin package updated in first post.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: peterlustig on March 01, 2010, 02:29:38 pm
Hi, I can't get this plugin to run on my page (www.familie-delling.de/pict; use ID: "temp", PW. "nopwd" to log in).
When trying to install, I just get the error message "There was an error while processing a database query." Any idea what this could be?

Thanks a lot for your help!

Best, Peter
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on March 01, 2010, 03:00:01 pm
Please enable debug mode and copy the real error message.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: peterlustig on March 01, 2010, 03:20:06 pm
Wow -- thanks a lot for the quick reaction!

ok, mayby I have to go for the longer story. I already had the plugin installed once, but whenever clicking on an album afterwards I just got a totally blank page as result. That's why I de-installed the plugin.
Now I when wanted to re-install, I had the problem described above, and thanks to your hint of using debug mode, I got the following error message:

While executing query "insert into cpg14x_plugins (name, path,priority)  values ("Album Addfav","album_addfav2",6);" on 0

mySQL error: Doppelter Eintrag 'Album Addfav' f�r Schl�ssel 'name'

[the German mySQL error says that the key in 'Album Addfav' is doubled] Thus, I assumed that the previous un-install wasn't well completed, so I deleted the folder 'album_addfav' in the \plugin subdir and re-copied it. Now the plugin could be installed, at least the plugin-mgr says so, but I have the known problem blank albums again. I even don't get any output of the debugging console on those blank pages -- maybe you could have a look at it yourself?

Vielen Dank bereits für Deine Hilfe!!
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on March 01, 2010, 03:52:14 pm
Please delete the appropriate database entry. Now you should be able to install the plugin.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: peterlustig on March 01, 2010, 04:08:05 pm
sorry, I am a perfect newbie. Which entry would I have to erase? And how can I do this?
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on March 01, 2010, 04:21:40 pm
You have to use a database management tool like phpMyAdmin or MySQLDumper. Then go to the table 'plugins' and erase the Album Addfav row.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: peterlustig on March 01, 2010, 05:10:37 pm
ok, I did so, deleted the Album addfav row via myPHPadmin, uninstalled addfav and then re-installed -- and the same problem is persisting, I get blank white pages when clicking on an album after reinstall.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on March 01, 2010, 05:46:26 pm
It's not possible to uninstall a plugin that has been deleted in the database. After deleting the database record, this plugin is automatically uninstalled.

Anyway, I assume you are doing something wrong. The plugin works without any problems in my gallery. Do you use some other plugins? How do you upload the plugin (http, ftp)?
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: peterlustig on March 01, 2010, 05:54:12 pm
sorry, should have been more exact in my description: had the "addfav"-line deleted via myPHP and then deleted the "album_addfav" directory via ftp.
then uploaded again (a newly unzipped version of the directory "album_addfav") to the plugin folder, installed via pluginmanager, and voila, blank pages are back.

yes, I use some other plugins, but the problem persist also after uninstalling ALL plugins, and only having addfav installed.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on March 02, 2010, 08:56:57 am
Please open plugins/album_addfav/codebase.php and replace the whole function album_addfav_html with
Code: [Select]
function album_addfav_html($html) {
    $html = str_replace('<td class="sortorder_cell">', '<td><a href="index.php?file=album_addfav/album_addfav&album='.$_GET['album'].'" title="Add album to favorites"><img src="plugins/album_addfav/favorites.png" border="0" /></a>&emsp;</td><td class="sortorder_cell">', $html, $count);
    return $html;
}
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: peterlustig on March 02, 2010, 09:09:06 am
thanks a lot for your support! however, replacing the function didn't help :(  (I did so by changing a version of `codebase.php' on my harddisk and then transferring on the plugins folder via ftp, overwriting the existing file)

No seemingly change in what's going on, I still get a blank page when clicking on an album....
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on March 02, 2010, 09:37:47 am
Can you give me ftp access to your plugin directory? If yes, I'll give you my email address.
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: peterlustig on March 02, 2010, 09:40:42 am
I will -- can you give me your mailaddress?
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Αndré on March 02, 2010, 11:18:41 am
Problem solved. Your PHP version is too old for my plugin. The count parameter was added in PHP 5.1.0.

Everyone who is running PHP < 5.1.0 please replace the entire function album_addfav_html with the following code:
Code: [Select]
function album_addfav_html($html) {
    $html = preg_replace('/<td width="100%" class="statlink"><h2>(.*)<\/h2><\/td>/Usi', '<td width=\"100%\" class=\"statlink\"><h2>\\1 <a href="index.php?file=album_addfav/album_addfav&album='.$_GET['album'].'" title="Add album to favorites"><img src="plugins/album_addfav/favorites.png" border="0" style="display:inline" /></a></h2></td>', $html);
    $html = preg_replace('/<td width="100%" class="statlink">(.*)<\/td>/Usi', '<td width=\"100%\" class=\"statlink\">\\1 <a href="index.php?file=album_addfav/album_addfav&album='.$_GET['album'].'" title="Add album to favorites"><img src="plugins/album_addfav/favorites.png" border="0" style="display:inline" /></a></td>', $html);

    return $html;
}
Title: Re: Add all pictures/files from a particular album to your favorites
Post by: Joachim Müller on March 02, 2010, 03:37:52 pm
Hint: version_compare (http://www.php.net/manual/de/function.version-compare.php) can take care of such issues.