Tag Cloud - modify large font threshold?

How are the font sizes assigned in the Tag Cloud. Is there a threshold number of tags which assigns a tag to the largest font size.

Due to the size of my gallery, and the amount of images with the same tag, I seem to have a lot of tags getting assigned to the largest font size.

Is there a way to modify the code raising the the threshold, that triggers the largest font size?

Comments

  • See the function document for `printAllTags()` in http://www.zenphoto.org/documentation/plugins/_zp-extensions---tag_extras.php.html

    There are parameters to the function for the the minimum and maximum sizes. The font size is based on ratios of those items.
  • Ok...That seems simple enough, but I am not getting any change in my display. I changed "count_max=50" up to 500 and then 5000, and have no change in display. ZP should have printed no large font tags at that point. I tried changes all 3 instances of "count_max=50" on the page just to be sure. I am clearing my browser cache. Is there something else that needs to be cleared for code to take effect. Can't figure it out

    Also, I see how the minimum & max are set, but what determines when a tag graduates from the small size to the medium size font. I am seeing 3 font sizes. Is this calculated in the ratio, so I don't have control of the floor count for the medium size font?

    I also see there is an unanswered post similar to mine from 4 years ago:

    http://www.zenphoto.org/support/topic.php?id=4199#post-25033
  • The formula used is:

    `$size = min(max(round(($size_max*($count-$count_min))/($count_max-$count_min),2), $size_min),$size_max);`
  • Thanks for the quick response. Do you have any idea why when I change "count_max=50" up to 5000, I am not getting any change in my tag cloud. It should not print any tags in the large font size. Right? No tag would meet that threshold.

    I am editing /zp-extensions/tag_extras.php
  • Maybe my math is marginal, but seems to me that expression will make the size smaller as the count_max gets larger.
  • OK lets take this one step at a time. No matter what parameter of the four listed below is changed at /zp-extensions/tag_extras.php I get no change at all in the appearance of the tag cloud.

    * @param integere $size_min smallest font size the cloud should display
    * @param integer $size_max largest font size the cloud should display
    * @param integer $count_min the minimum count for a tag to appear in the output
    * @param integer $count_max the floor count for setting the cloud font size to $size_max

    Something is not allowing the changes to take effect. So what are the parameters for if they change nothing?
  • acrylian Administrator, Developer
    Do you have the static_html_cache plugin enabled? If so you might need to clear it. However you should not if you are viewing the site being logged in.
  • I do not have "static_html_cache" enabled. I tried renaming "tag_extras.php" and the Tag Cloud continues to load even after refreshing database & clearing browser cache, how could that be possible?

    Tags are showing without "tag_extras.php" even being present on the server. I don't get that.

    If I disable/enable "show tags" in theme, tags do turn off and on.
  • I just noticed the plug-in "tag_extras" is NOT enabled in plug-in settings. Changing has no effect.
  • acrylian Administrator, Developer
    If it is not enabled you are not using this plugin. There is a standard template function printAllTagsAs() you are probably using that also can print a tag cloud. That is used on standard theme's archive.php page. But you should have noticed which function call you change the parameters, the standard one or the tag_extras one...

    Also, to my knowledge no official theme has an option to disable tags. So you probably are using a third party one.
  • I tried editing "template-functions.php" and I still do not get any changes. I commented out the printAllTags area (lines 3645-3700) and the cloud disappeared so that is where my tag cloud is generated, not from "tag_extras.php".

    But changing any of the parameters listed below has no effect on the cloud. Can you look at that code and see if there might be a reason why parameters are not being checked?

    `


    **

    * Either prints all of the galleries tgs as a UL list or a cloud

    *

    * @param string $option "cloud" for tag cloud, "list" for simple list

    * @param string $class CSS class

    * @param string $sort "results" for relevance list, "abc" for alphabetical, blank for unsorted

    * @param bool $counter TRUE if you want the tag count within brackets behind the tag

    * @param bool $links set to TRUE to have tag search links included with the tag.

    * @param int $maxfontsize largest font size the cloud should display

    * @param int $maxcount the floor count for setting the cloud font size to $maxfontsize

    * @param int $mincount the minimum count for a tag to appear in the output

    * @param int $limit set to limit the number of tags displayed to the top $numtags

    * @param int $minfontsize minimum font size the cloud should display

    * @since 1.1

    */

    function printAllTagsAs($option,$class='',$sort='abc',$counter=FALSE,$links=TRUE,$maxfontsize=2,$maxcount=50,$mincount=10, $limit=NULL,$minfontsize=0.8)


    `

  • Ok.....Tried Garland and it works. So it is zpArdoise theme. If the theme calls the printAllTags function I wonder why I can't make any changes?

    Sorry for the all questions zpArdoise really needs to provide a little more support for his theme. I have not seen him offer support once since I have asked questions with zpArdoise mentioned.
  • acrylian Administrator, Developer
    NEVER modify core files. You need to find the call of the tag cloud on your theme and change the parameters there.

    If you change the parameters on the template-functions natrually the call on the theme overrides that. So you will not see any change. Did you read the theming tutorial?

    Since you didn't tell what theme you are using it very well might be that it uses something custom for the tag cloud.
  • acrylian Administrator, Developer
    You did not mention zpArdoise here at all ... Anyway, the theme's author is a volunteer as we all are and will provide as much support as he can. Which he normally does.
  • Figured it out....In case anyone else is interested, the paramaters are changesd at: /themes/zpArdoise/gallery.php

    `
    <?php if (getOption('show_tag')) { ?>



    <?php printAllTagsAs('cloud', 'hor-list','abc', false, true, 2.5, 40, 10, NULL, 1); ?>


    `
  • Can't get a random sort even when all params for sort are left blank. Hmmm.
  • vincent3569 Member, Translator
    hi

    indeed, if zpardoise is not in the title of the message, I can simply miss the subject (I do not read all the forum posts).
    you can also ask me for support on my website.
    notice that I do my best to develop my theme for free on my free time and I am not sure that all 3rd party themes offer the same thing...

    I use `printAllTagsAs` in gallery.php :
    `<?php printAllTagsAs('cloud', 'hor-list', 'abc', false, true, 2.5, 30, 5, NULL, 1); ?>`

    you should modify the parameters of the function in gallery.php, like that for example :
    `<?php printAllTagsAs('cloud', 'hor-list', 'abc', false, true, 2.5, 500, 5, NULL, 1); ?>`
  • Thanks Vincent, appreciate the help.

    Anyone know why when I leave the sort "blank", I do not get a randomly sorted cloud? I tried with Garland also & coud not get a random sort as stated in paremeter details:

    `* @param string $sort "results" for relevance list, "abc" for alphabetical, blank for unsorted`

    Like this:
    `<?php printAllTagsAs('cloud', 'hor-list', '', false, true, 2.5, 500, 5, NULL, 1); ?>`
  • vincent3569 Member, Translator
    Can't get a random sort even when all params for sort are left blank.

    in fact, you have only one option for $sort value: "results" for relevance list.
    all other values (null, "abc", '', "anything",...) causes an alphabetical order.
    there is no option for tag random order (but maybe it would be a nice option).

    @ zenphoto team :
    the documentation of printAllTagsAs il not really the truth :
    `"results" for relevance list, "abc" for alphabetical, blank for unsorted`, and I don't really understand what "unsorted" means in our case.
  • Thanks for the tip Vincent. Looks like there is no way to do a random sort. Your right, any input except "results" prints in alphabetical order. Random order would be a nice option, making a better looking cloud.

    Just out of curiosity, I googled word cloud images & couldn't find any that were sorted alphabetically.
  • acrylian Administrator, Developer
    Please open a ticket, might be that something got lost on the way.
  • "unsorted" really means the way they were found--no particular organization.
  • BTW, I would guess that some consideration should be made for how a "random" sort meshes with the limit parameter. Do you randomize before or after taking the limiting function? If you do it before you will get a different set of tags each time the cloud is displayed.
  • acrylian Administrator, Developer
    Looking at the `printAllTagsAs` function it seems only the sortorder "results" is checked. In that case the resutls is sorted by `arsort`. "abc" is not checked or sorted at all. All tags are fetched by `getAllTagsCount()`. So either that has been forgotten or got lost. But in any case that must be that way for years...

    Interestingly the tags_extras plugin which was modeled after this does not even have a sort parameter.
  • vincent3569 Member, Translator
    in `getAllTagsCount`, you will find this code :
    `$sql = "SELECT DISTINCT tags.name, tags.id, (SELECT COUNT(*) FROM ".prefix('obj_to_tag')." as object WHERE object.tagid = tags.id) AS count FROM ".prefix('tags')." as tags ORDER BY 'name'" ;`

    so, in `printAllTagsAs`, in all case but `$sort="results"`, tags are by alphabetical order.
Sign In or Register to comment.