Forums

[Plugin: NextGEN Gallery] I now am displaying pic's from a tag cloud! (36 posts)

  1. realsol
    Member
    Posted 1 year ago #

    I know this has been asked before so I thought I would share how I do it.

    I added a tag cloud to my side bar and added a POST called 'Custom Gallery'. Each time I add a new gallery and tag the pictures, I go to my 'Custom Gallery' post and add new tags there. Most the time the tag's are already there anyhow, but I check. This way, my Tag Cloud will pick up my new tags.

    Then for the body of the post (I am using the exec-php plug-in) I put in:

    <?php
    if ($_REQUEST["tag"] <> "") echo "[tags=".$_REQUEST["tag"]."]";
    ?>

    Works great. I am probably going to use the album tag if multiple tags are being searched. Makes more sense. I'll have to replace the '+''s with ',''s when I do this in php.

    I would also like to figure out how to search tags like tag1+tag2 so the return is only the pictures that include both tags. Does anyone no how to do this?

    Thanks. Hopefully someone has the answer to multi taged custom galleries. Hope my code helps someone out there.

  2. realsol
    Member
    Posted 1 year ago #

    OK. I like this one better:

    <?php
    if ($_REQUEST["tag"] <> "")
    {
    $tags = str_replace(" ",",",$_REQUEST["tag"]);
    echo '[albumtags='.$tags.']';
    } else echo "NO PHOTO's FOUND that match the TAG you clicked on.";

    ?>

    But I still would like to be able to search for all tag's combined instead of having two albums display. See me earlier post.

  3. yyeric
    Member
    Posted 1 year ago #

    Hi Realsol,

    Very Clever! Is it possible that you could show us an example of how it actually works from the front end?

    I have been looking for something like tag cloud for NextGen image tags too.

    Cheers,

    Eric

  4. realsol
    Member
    Posted 1 year ago #

    I am running a plugin call EXEC-PHP which allows you to input PHP scripts within the HTML portion of the page. You also have to run a plug-in that disables the Visual tab for that particular post or page (mentioned in the doc of EXEC-PHP). I just pasted the above code into the HTML portion and added a tag cloud widget.

    I guess it could be written as a plug-in so you could just add something like [nextgen-tagcloud]. Hey, that would be pretty slick for those that I know can't turn on php scipts for their blog (like many WordpressMU users). Maybe I can put something together.

  5. yyeric
    Member
    Posted 1 year ago #

    Thanks mate,

    Hope you don't mind me being a pain, but could you walk me through the setup?

    1. I have exec-php setup. It's nice and working.
    2. I insert your php tag onto a post (here)
    3. how do I actually go from here?

    Any assistance will help,

    Cheers,

    Eric

  6. yyeric
    Member
    Posted 1 year ago #

    Mate, Not sure if you could give me a hand with this, but I am working on extracting all my tags from the database

    <?php
    
    	global $wpdb;
    	$sql = 'SELECT COUNT(*) FROM wp_ngg_tags ';
    	$count= $wpdb->get_var($sql);
    echo $count;
    echo "<hr>";
    
    for ( $counter = 1; $counter <= $count; ) {
    
    $row = 'SELECT name FROM wp_ngg_tags where id='.$counter;
    
    $name= $wpdb->get_var($row);
    
    echo $name;
    
    $counter=$counter+1;
    
    }
    ?>

    do you know why it doesn't display all the tag names?

    Cheers,

    Eric

  7. realsol
    Member
    Posted 1 year ago #

    Yeah, I could probably mess things up...

    Since my nextGEN galleries are small right now, adding the individual tags is no problem for me. It would be nice though if you could pull all the tags. I just don't have time to do it. I just manually added my tags to the post I created. Only about 10 galleries setup, so it was easy.

    I am hoping that someone will see this post and somehow add an option into the gallery that will basically do what I am doing with a 'real' shortcode built into nextGEN that won't require me to update tags.

  8. yyeric
    Member
    Posted 1 year ago #

    I am still pretty much in the dark as to how yo got it to work! Seems real simple but just couldn't figure it out.

    Do you have a post (titled Customer Gallery), which list all the tags, and create another post which includes your php.

    How come it doesn't seem to connect the dots for me.

    Perhaps I am missing something from your method.

    E

  9. yyeric
    Member
    Posted 1 year ago #

    I've worked out to generate a list of tag for NGG and to link them to create post for tag when you do a ?tag=blad on URL.

    Will update in a few hours

  10. yyeric
    Member
    Posted 1 year ago #

  11. yyeric
    Member
    Posted 1 year ago #

  12. yyeric
    Member
    Posted 1 year ago #

    updated the php in 1st post, to make it more "tag cloud"-like..

    <?php
    global $wpdb;
    $results  =$wpdb->get_results(
    		  ' SELECT tagid as tagID , count( tagid ) as tagCount , taggs.name as tagName, taggs.slug as tagSlug '
            . ' FROM wp_ngg_pic2tags picstags , wp_ngg_tags taggs '
            . ' where taggs.id = picstags.tagid '
            . ' group BY tagid ');
    foreach ($results as $row) {
    
    echo "<span style=\"font-size:". (1.6*(log((20000*($row->tagCount)))))."px;\"><a href=\"http://www.canberrapictorial.com.au/image?tags=".$row->tagSlug."\">".$row->tagName."</a></span>";
    echo " | ";
    }
    
    ?>

    it's dumb, but any thoughts as to how it make the cloud not blown up of proportion if it gets too big in numbers?

  13. yyeric
    Member
    Posted 1 year ago #

    Tutorial

    Put together something to assist perhaps someone wanted to use tag cloud for NGG.

  14. realsol
    Member
    Posted 1 year ago #

    Looks good. You could use the tag plugin I am using, SensitiveTagCloud Widget which lets you 'drill down' your tags. Search the plug-in's for a better description.

    You would need to use your php to update the 'tags' portion of the page that you want to display your pictures using the codex. But all the tags would be the same size.

    You idea is good, but I would probably make it only one page instead of 2 pages and have it call itself. With a little code changes you could actually create your own 'drill-down' method.

  15. alexrabe
    Member
    Posted 1 year ago #

    Very interesting addon !!! I will see to get tag clouds working after release of v1.00, because then the tags are sync with the WordPress Taxonomy

  16. realsol
    Member
    Posted 1 year ago #

    That would be GREAT! One thing I can't figure out to do, although I haven't tried querying the database like yyeric, I would like to be able to drill down my tags.

    I am using SenisitiveTagCloud which allows my to drill down WordPress tags, basically showing it the url 'tag=joey+birthday+family' and display's only posts related to all the tags. Right now, nextGEN tags using '[tags=item1, item2, item3 ...]' display individual galleries, on for each tag, or '[albumtags=item1, item2, item3 ...]' in album format. it would be great if a user is using a plugin like SensitiveTagCloud to be able to drill down their nextGEN gallery.

    Right now, I have tagged all of my pic's by year, event, person .... I get 3 different galleries. Still makes it easier to find what I am looking for, but the drill-down would be great! Basically a built-in keyword search of all your pictures.

    And since WordTube also supports tags, this might also work for it (although I put each individual video on its own post with tags, using the tag cloud to drill down those).

    OK. Someone stop me. I'm on a roll.

    If tags were available for each album and each gallery + the individual pictures (already there), you could have a new shortcode called [nextgen=item1, item2, item3 ....]. Here is the logic.

    Still using a SensitiveCloudWidget,

    • 1st tag: Search for albums with matching tag. If no matches, search the galleries for the tags. If no gallery matches searches the pictures for the tags.
    • 2nd tag: Search for all galleries within that album with matching tags. If no matches, searches individual pics.
    • 3rd tag, 4th tag, 5th tag....: Search for all pictures with matching tags within the matching gallery + only displays the pictures that included all of the tags for picture drill down.

    I organize all of my albums by year and my galleries by event. But this would be great also for people selling pictures.

    Whew... Sorry for all of the text. I love nextGEN so much. I am running WordPressMU for my business and my family and won't let them install any other plug-in. The only thing I found that it lacks is any sort of dynamic searching capabilities, but has all the tags in place to do it.

    Alexrabe, please let me know what you think.

    Thanks for your time and hard work.

  17. yyeric
    Member
    Posted 1 year ago #

    Hi Guys,

    image library

    I have just worked out a simple way to search tags, via the SQL-generated tag cloud. It's just a couple of SQL queries.

    I will work out now to do multiple tag selection via tickboxes. Something like generating [tags=MBL, Boston, 2008, WSC] via multiple-tickboxes selection.

    But, ya, it would be great if Alex would be able to implement a tag cloud which works with the WP tag system.

    Cheers,

    Eric

  18. realsol
    Member
    Posted 1 year ago #

    I'll tell ya, just looked at your image library it the tag's look great. Great pic's by the way.

    For myself, as my blog page isn't quite as large, would lower the font size and put the code into a text widget to display on the sidebar.

    I am starting to like the idea keeping the photo tags separate from the blog tags though. Thought I wouldn't say that. I might tag the page itself with my top level tags, like 2008, 2007, 2006... so a user could jump to the photo tag page from within my standard wordpress blog tags, but then display a separate tag cloud once on the page showing only my photo tags, since there will probably be a lot once I get all my pic's online.

    This way also a user could click on another tag 3 drill down, once you figure the SQL stuff. I wish I had more time to spend on it than I do. Looks like fun. I would have to brush up on my SQL a bit I'm afraid. Seems like I get deep into something when I need it, then move on to another language (Delphi is my money maker) and then forget everything I learned. It's been 7 years since I really did anything in PHP. But I am having a blast.

    Let me know how the progress is going.

    And Alex, keep up the work!!

    Thanks yyeric.

  19. realsol
    Member
    Posted 1 year ago #

    Oh, when I say drill down, I mean:

    • Show ALL tag cloud
    • When a user clicks on a tag, then show a tag cloud showing only the tags that include the tag chosen.
    • When a user clicks on another tag, show only a tag cloud that included the 2 tags already chosen, and so on.

    This way, a user can drill down to what the want. I would also include within the tag a 'All Images' tag, big, so a user could go back to the beginning easily.

    I hope you know what I mean...

  20. alexrabe
    Member
    Posted 1 year ago #

    Thanks Eric & Realsol for your ideas, very helpful for the further dev.

    If you are interested (and have time) check out the current trunk of Version 1.00, during the upgrade routine I added all image tags to the WordPress tag tables and from this point I would later go on to build a Tag cloud or what ever is usefull. The tables wp_ngg_pic2tags & wp_ngg_tags will be then dropped...

    Please use the trunk only on a test system, it could break your live blog.

  21. realsol
    Member
    Posted 1 year ago #

    I thought I would share this bit of code I use to browser my albums and search my tags all within the same page or post. You have to be able to execute php on a page or post in order to run this, but I works pretty well, I use this in combination with the tag cloud mentioned above. And I hide the post from casual visitors useing the hidepost plugin.

    yyeric, you might like this along with your tag cloud. Great way to integrate a tag based gallery, with and albumtag and gallery tag.

    Basically, you either select the album, or you do a search. It also is a great management tool. If I new javascript better (just learning) I probably could have fun with this...


    [hidepost]
    Select an Album or search for what (or who) you are looking for.
    <script type="text/javascript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
    }
    //-->
    </script>

    <table width="100%" border="0">
    <tr>
    <th valign="top" scope="row"><?php
    global $wpdb;
    $albumlist = $wpdb->get_results("SELECT * FROM $wpdb->nggalbum ORDER BY id ASC");
    ?>
    <select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('parent',this,0)">
    <option value="">Select Album</option>

    ';

    <?php
    if(is_array($albumlist))
    {
    foreach($albumlist as $album)
    {
    if ($_POST['myalbum'] == $album->id) $selected = 'selected="selected" ';else $selected = '';
    echo '<option value="http://yoururl.com/?page_id=YourID&myalbum='.$album->id.'">'.$album->name.'</option>';
    }
    }
    ?>
    </select></th>
    <td><form name="form1" method="get" action="http://yoururl.com" >
    <p>
    <input name="page_id" type="hidden" value="54">
    <input name="tag1" type="text">
    <input type="submit" name="submit" id="submit" value="Search">

    </p>
    </form></td>
    </tr>
    </table>

    <?php
    if ($_REQUEST["tag1"] <> "")
    {
    echo "[tags=".$_REQUEST["tag1"]."]";
    } elseif ($_REQUEST["myalbum"] <> "")
    {
    echo "[album=".$_REQUEST["myalbum"].",extend]";
    }
    ?>
    [/hidepost]
    Currently there are no public Pictures online. You will need to log-in to see any of my albums.

    Anyhow, just thought I would share it.

  22. realsol
    Member
    Posted 1 year ago #

    Woops. hit submit twice.

  23. yyeric
    Member
    Posted 1 year ago #

    G'Day, Is there a demo on your site that we can have a look?

    Eric

  24. realsol
    Member
    Posted 1 year ago #

    Yeah, I will have to get it back up. Been moving things around and am having a hard time getting the time to upload again since the flash upload doesn't work for me and I am running Wordpress MU and that just adds another layer of heartache.

    I'll let you know.

  25. realsol
    Member
    Posted 1 year ago #

    Until the flash upload is fixed or nextGEN can create galleries for uploaded files, I am going to be using a different plug-in. Been fun while it lasted, but I don't feel like going through everything over again.

  26. tommo77funk
    Member
    Posted 1 year ago #

    Hi,

    Thank you so much for posting this php code to allow tags for nextGen, I have followed the tutorial kindly posted by yyeric, and all is working apart from when i click a tag in the cloud, I am not getting the resulting pics to show.

    Anyone know what i'm doing wrong ?

    here is a link http://tommills.co.uk/latestnews/image-library/

    Really grateful for any advice :)

    best wishes,

    tom

  27. shopefowler
    Member
    Posted 1 year ago #

    I used part of yyeric's code to output the tag list in the sidebar of my page. I'm not really a programmer, so I have no idea if this is the best way to do it, but it's working for what I need it for.

    I created a new page called "tags" (id=46) with the content:
    [albumtags=]

    Then put this code in my gallery page sidebar to output the tags as links:

    Show photos of:<br /><ul class="galtags">
    <?
    global $wpdb;
    $results = $wpdb->get_results('SELECT name, slug FROM wp_ngg_tags');
    foreach ($results as $row) {
    
    echo "<li><a href=http://www.fathernaturelandscapes.com/nggallery/page-46/tags/";
    echo $row->slug;
    echo ">";
    echo $row->name;
    echo "</a> </li> ";
    }
    ?>
    </ul>

    The link in the sidebar code uses the tags page id and slug to make it work. Don't really understand why, but there you have it.

    Here's the gallery page in action.
    Here's a more indepth explanation of what I did.

  28. tommo77funk
    Member
    Posted 1 year ago #

    Hi,

    Thanks for reply shopefowler. After quite a few hours I managed to get yyeric's code to work. The trouble was creating the url to display the images :)

    Yyeric if you are reading this, a thousand thank you's ! and also to realsol !

    I am a very happy man :)

    best wishes,

    tom

    p.s. I will post link to library when finished, right now I have an awful lot of tagging to do :)

  29. yyeric
    Member
    Posted 1 year ago #

    G'Day guys,

    It's all for a better NextGen Gallery to come! Thanks Alex for all the development work.

    By the way, if you want tag cloud to be listed in alphabetical order

    $results = $wpdb->get_results('SELECT name, slug FROM wp_ngg_tags ORDER by name');

    tommo77funk you have got some great photography works out there!
    will do.

  30. yyeric
    Member
    Posted 1 year ago #

    For those who might be interested. I wrote up a little SQL to bring back "Related Tags" after you are viewing [tags=Whatever] via $_REQUEST["tags"]

    To get a feel of what it is like. Please click through to Canberra Pictorial Image Library. Select on any of the tags listed in the page. Or click directly here on one of the tags: AIS Basketball.

    It brings back all the "other" tags which were embedded with "all" images listed in the page.

    I will write up a quick tutorial very soon.

    Cheers,

    Eric

Topic Closed

This topic has been closed to new replies.

About this Topic