adding pictures to favorites adding pictures to favorites
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

adding pictures to favorites

Started by alanpalan, November 08, 2007, 07:40:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alanpalan

is there a way to do this by users of coppermine? (adding/removing) thanks.

Joachim Müller

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.

alanpalan

No, i was wondering if is there a way *for users* to add photos to their favorites.
Ok.

alanpalan

Like user can do it on Youtube for examaple. It would be great feature.

Nibbler

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.

alanpalan

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?

Joachim Müller

Sure, go ahead.
Marking thread as "solved".

alanpalan

I expected more contributive answer than "sure, go ahead" :)

alanpalan

or do I have to create new topic for this question?

Alfinators

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


Bernd1975

THNX A LOT
This saved me a lot of time!

Good Job!

Alfinators


socalboy

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

Nibbler

You need to wrap this code


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


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

global $FAVPICS;

I don't know the context of the code.

socalboy

Thank you very much, this worked like a charm!

Steven

DeJay

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.

DeJay


Nibbler

Just add an else block to the code I posted but with 'Remove from' instead of 'Add to'.

DeJay

Sorry Nibbler, you're basically talking to a coding idiot. How do you express the 'else block' in code? Thanks.