forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: alanpalan on November 08, 2007, 07:40:41 pm

Title: adding pictures to favorites
Post by: alanpalan on November 08, 2007, 07:40:41 pm
is there a way to do this by users of coppermine? (adding/removing) thanks.
Title: Re: adding pictures to favorites
Post by: Joachim Müller on November 09, 2007, 08:04:06 am
Are you asking how to add files to the favorites list of your users? Why would you do that? It wouldn't be their list of favorites then, but yours. Anyway: out of the box, such a feature doesn't exist. You'll have to run some queries against the table 'yourCoppermineTablePrefix_favpics' to accomplish this.
Title: Re: adding pictures to favorites
Post by: alanpalan on November 09, 2007, 11:36:11 am
No, i was wondering if is there a way *for users* to add photos to their favorites.
Ok.
Title: Re: adding pictures to favorites
Post by: alanpalan on November 09, 2007, 11:39:06 am
Like user can do it on Youtube for examaple. It would be great feature.
Title: Re: adding pictures to favorites
Post by: Nibbler on November 09, 2007, 12:24:00 pm
It works the same as youtube - click the link below the picture to add it to your favourites. If you have set the file information section to be hidden by default in config then you won't see the link unless you click on the (i) button above the pic first to display it.

A link to your gallery would help if you can't figure it out.
Title: Re: adding pictures to favorites
Post by: alanpalan on November 09, 2007, 06:35:47 pm
Cool, I see it. Thanks!  ;)
Can I move that link "Add to Favorites" to some more visible place? For example right under the particular photo?
Title: Re: adding pictures to favorites
Post by: Joachim Müller on November 09, 2007, 06:47:48 pm
Sure, go ahead.
Marking thread as "solved".
Title: Re: adding pictures to favorites
Post by: alanpalan on November 09, 2007, 07:04:59 pm
I expected more contributive answer than "sure, go ahead" :)
Title: Re: adding pictures to favorites
Post by: alanpalan on November 09, 2007, 07:15:16 pm
or do I have to create new topic for this question?
Title: Re: adding pictures to favorites
Post by: Alfinators on December 07, 2007, 02:17:04 am
Ok i have solution :)
download this mod
http://forum.coppermine-gallery.net/index.php?topic=36302.0

Now you must remove BB links
Find in codebase.php
Code: [Select]
//this just brings everything in form... we create a table etc.
$bbcode_data = '<table align="center" width="'.$CONFIG['picture_width'].'">'.$script_data.'<tr>';
$bbcode_data .= '<td>[url][img][/url]</td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40" style="overflow:off;">'.$img_url.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$img_url.'")\'></td>';

$bbcode_data .= '</tr><tr>';

$bbcode_data .= '<td>[url]title[/url]</td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40">'.$name_url.'</textarea><input type="button" value="Copy" onclick=\'copy_clip("'.$name_url.'")\'></td>';

$bbcode_data .= '</tr></table>';

Remove BB links - you get this
Code: [Select]
//this just brings everything in form... we create a table etc.
        $bbcode_data = '<table align="center" width="'.$CONFIG['picture_width'].'">'.$script_data.'<tr>';
$bbcode_data .= '</tr><tr>';
$bbcode_data .= '</tr><tr>';
$bbcode_data .= '</tr></table>';

Replace with this code
Code: [Select]
//this just brings everything in form... we create a table etc.
$bbcode_data = '<table align="center" width="'.$CONFIG['picture_width'].'">'.$script_data.'<tr>';
$bbcode_data .= '</tr><tr>';
$bbcode_data .= "<td colspan=\"2\" align=\"center\"><a href=\"addfav.php?pid={$pic_data['pid']}\">Add to Favorites</a></td></tr><tr>";
$bbcode_data .= '</tr><tr>';
$bbcode_data .= '</tr></table>';

Go to cofnig/manage plugins/ and install "Paste BB Code image url v1.2"

Text "Add to Favorites" you can replace with image
Sample
 
Code: [Select]
<img border=0 src=\"fav.gif\" >
And forgive my English :)
 
Sample in use
http://wallpapers.digitalne.eu/displayimage.php?album=favpics&cat=0&pos=1
Title: Re: adding pictures to favorites
Post by: Alfinators on December 07, 2007, 02:37:33 am
Sorry last link doesn't work.
New Sample
http://wallpapers.digitalne.eu/displayimage.php?album=random&cat=0&pos=-994
Title: Re: adding pictures to favorites
Post by: Bernd1975 on February 04, 2008, 08:27:15 pm
THNX A LOT
This saved me a lot of time!

Good Job!
Title: Re: adding pictures to favorites
Post by: Alfinators on February 08, 2008, 10:35:31 pm
No problem :)
Title: Re: adding pictures to favorites
Post by: socalboy on February 29, 2008, 08:18:43 pm
This is a great addition to my gallery, but is there a way to make Add to Favorites dissappear if the photo has already been added? This would work similar to the Add Favorites to Lightbox from Nibbler. The issue with that plugin is that it does not add favorites from the photo page itself, just the thumbnails pages. So if I can get this code to work I would really appreciate it. Thanks in advance for the help.

Steven
Title: Re: adding pictures to favorites
Post by: Nibbler on February 29, 2008, 08:23:54 pm
You need to wrap this code

Code: [Select]
//this just brings everything in form... we create a table etc.
$bbcode_data = '<table align="center" width="'.$CONFIG['picture_width'].'">'.$script_data.'<tr>';
$bbcode_data .= '</tr><tr>';
$bbcode_data .= "<td colspan=\"2\" align=\"center\"><a href=\"addfav.php?pid={$pic_data['pid']}\">Add to Favorites</a></td></tr><tr>";
$bbcode_data .= '</tr><tr>';
$bbcode_data .= '</tr></table>';

in a condition, maybe like this:

Code: [Select]
if (!in_array($pic_data['pid'], $FAVPICS)){
//this just brings everything in form... we create a table etc.
$bbcode_data = '<table align="center" width="'.$CONFIG['picture_width'].'">'.$script_data.'<tr>';
$bbcode_data .= '</tr><tr>';
$bbcode_data .= "<td colspan=\"2\" align=\"center\"><a href=\"addfav.php?pid={$pic_data['pid']}\">Add to Favorites</a></td></tr><tr>";
$bbcode_data .= '</tr><tr>';
$bbcode_data .= '</tr></table>';
}

You probably also need

Code: [Select]
global $FAVPICS;
I don't know the context of the code.
Title: Re: adding pictures to favorites
Post by: socalboy on March 01, 2008, 08:46:06 am
Thank you very much, this worked like a charm!

Steven
Title: Re: adding pictures to favorites
Post by: DeJay on March 28, 2008, 09:56:06 pm
Hi Nibbler. This is a great function. The only problem is that the 'Add to my favourites' icon does not get replaced with 'Remove from my favourites' once clicked. Instead it just stays as 'Add to my favourites' (even though it will remove the file if clicked). What extra bit of code do I need to correct this?

Thanks.
Title: Re: adding pictures to favorites
Post by: DeJay on March 31, 2008, 06:29:44 am
Anyone?
Title: Re: adding pictures to favorites
Post by: Nibbler on March 31, 2008, 06:44:00 am
Just add an else block to the code I posted but with 'Remove from' instead of 'Add to'.
Title: Re: adding pictures to favorites
Post by: DeJay on March 31, 2008, 09:36:52 am
Sorry Nibbler, you're basically talking to a coding idiot. How do you express the 'else block' in code? Thanks.