4images Forum & Community
4images Modifications / Modifikationen => Templates & Styles (Requests & Discussions) => Topic started by: Chris on March 12, 2005, 10:39:37 PM
-
By default, the category_bit.html template displays a folder icon next to categories. It is possible to also display a thumbnail of an image selected at random from that category.
In the category_bit.html template that ships with the downloaded distribution of 4images, there is the following:
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<img src="{template_url}/images/folder.gif" width="20" height="13" alt="" />
<!-- {if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" border="1"></a>{endif random_cat_image_file} -->
</td>
<td> <a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new} </td>
</tr>
</table>
As you can see above, there is already HTML that can display a random category image thumbnail. It is simply commented out. To activate the thumbnail, uncomment the HTML. In this example the folder icon HTML is deleted in favor of the image thumbnail.
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
{if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" border="1"></a>{endif random_cat_image_file}
</td>
<td> <a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new} </td>
</tr>
</table>
Lastly, this feature is enabled by default, but if you previously edited includes/constants.php, check to ensure that the following line is present in that file:
define('SHOW_RANDOM_CAT_IMAGE', 1);
-
Thanks Chris :D
Is it possible to do this with the categories and/or subcats listings on the homepage?
-
HI!
Your mod works but it has a little problem, the thumbnail size it's the same that the categories thumbnail. The idea it's to have a small tumbnail before the name of the sub-category something like 60x40 or less, but a thumbnail of 100x75 it's too much. There is any way to put inside the size of the thumbnail? and force to have the same size in all the thumbnails? Thanks!!
-
Is it Possible to do this with Mantra's Templates as i cant find the code you show here i am using the 4images dark from his site (http://www.mantradream.com) ?
I posted on his forum he told me to post here because he didn't know
Thanks in advance :lol:
-
yes, u can.
-
Your mod works but it has a little problem, the thumbnail size it's the same that the categories thumbnail.
It's not a mod and there is no problem. The thumbnail size is working the way it was designed.
-
yes, u can.
Can You Tell Me Where I need To Modify Please Because I cant Find The Code As Shown Above :?:
This All The Code From The 4images_Dark Template catorgory_bit.html Sorry If I'm Being Blind :oops:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" rowspan="2" align="center" valign="top">
<a href="{cat_url}"><img src="{template_image_url}/category{cat_id}.gif" border="0" alt="{cat_name}"></a></td>
<td align="left" valign="top"><a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})</td>
</tr>
<tr>
<td align="left" valign="top">{if cat_description}<span class="smalltext">{cat_description}</span><br />{endif cat_description}</td>
</tr>
</table>
{if sub_cats}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" align="center" valign="top"><img src="{template_image_url}/joinbottom.gif"></td>
<td align="left" valign="top">{sub_cats}</td>
</tr>
</table>
{endif sub_cats}
Thanks In Advance :)
-
c'mon! just look at the difference between the "seached" code provided and the result code!
-
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td valign="top">
{if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}"><width="25" height="33" border="1"></a>{endif random_cat_image_file}
</td>
<td> <a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new} </td>
</tr>
</table>
I did this changes in this code to obtain a small thumbnail with the same size in all the sub-categories.
First of all I added 3 points to "cellpadding" because in the first change I did it was next to the name. This correct the problem and secund I have added width and height as you see in the script and all the thumbnails are axactly the same size taking the pics from the category or sub-category.
Check it here: http://www.celebridadesperuanas.com/galeria
Thank you Chris, you knew what I was looking for but you just told me that this script wasn't a mod, that answer didn't teach me anything, thanks God I could find the answer by myself but...is this the Forum idea? Is this how we share knowledge?...from people who knows very much to people as myself who doesn't know anything?? Thanks anyway...You have create the script and with out it I never could find the solution
-
Thank you Chris, you knew what I was looking for but you just told me that this script wasn't a mod, that answer didn't teach me anything, thanks God I could find the answer by myself but...is this the Forum idea? Is this how we share knowledge?...from people who knows very much to people as myself who doesn't know anything?? Thanks anyway...You have create the script and with out it I never could find the solution
Please understand that I'm just a volunteer like the others and did not develop the 4images product. To my knowledge it belongs to Jan and no one else. I don't always have time to personally tutor everyone on everything under the sun. Although I do think I've spent a great deal of time over the last 2 years doing just that...
In this case, the thread simply points out something that can already be done with the existing product and requires no coding changes. That's all I had time for when I posted it and that's all I intend to do with this thread.
Best wishes.
-
Hi Chris!
You are right, I am sorry.
Regards
-
By default, the category_bit.html template displays a folder icon next to categories. It is possible to also display a thumbnail of an image selected at random from that category.
In the category_bit.html template that ships with the downloaded distribution of 4images, there is the following:
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<img src="{template_url}/images/folder.gif" width="20" height="13" alt="" />
<!-- {if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" border="1"></a>{endif random_cat_image_file} -->
</td>
<td> <a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new} </td>
</tr>
</table>
As you can see above, there is already HTML that can display a random category image thumbnail. It is simply commented out. To activate the thumbnail, uncomment the HTML. In this example the folder icon HTML is deleted in favor of the image thumbnail.
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
{if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" border="1"></a>{endif random_cat_image_file}
</td>
<td> <a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new} </td>
</tr>
</table>
Lastly, this feature is enabled by default, but if you previously edited includes/constants.php, check to ensure that the following line is present in that file:
define('SHOW_RANDOM_CAT_IMAGE', 1);
OK - so... removing the 'Comment Out' gives me code that still shows the folder icon AND the random image. I changed the code to the following:
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<img src="{template_url}/images/folder.gif" width="20" height="13" alt="" border="0" />
{if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" width="20" height="13" border="0"></a>{endif random_cat_image_file}
</td>
<td>
<a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new}
</td>
</tr>
</table>
{if cat_description}<span class="smalltext">{cat_description}</span><br />{endif cat_description}
{if sub_cats}{sub_cats}{endif sub_cats}
It would be nice if the random image icon would show up without the folder, and only show the folder if no random image was found. I just can't see where this is done.
-
It would be nice if the random image icon would show up without the folder, and only show the folder if no random image was found. I just can't see where this is done.
With the EXIF MOD, it would be easier to convert
this line :
<img src="{template_url}/images/folder.gif" width="20" height="13" alt="" />
into :
{ifno random_cat_image_file}<img src="{template_url}/images/folder.gif" width="20" height="13" alt="" />{endifno random_cat_image_file}
From there, it would even be much easier, for you, to customize this line rather than modifying a whole paragraph in order to replace a folder icon into a thumbnail presentation. ;)
-
{ifno random_cat_image_file}<img src="{template_url}/images/folder.gif" width="20" height="13" alt="" />{endifno random_cat_image_file}
From there, it would even be much easier, for you, to customize this line rather than modifying a whole paragraph in order to replace a folder icon into a thumbnail presentation. ;)
please note, for this to work u'll need install "{ifno blah}...{endifno blah}" mod/fix (try FAQ) ;)
-
Correction of the name - added with the URL this time :
http://www.4homepages.de/forum/index.php?topic=7493.0
-
what do you have to do to show a image(different for each categorie)in place of that folder icon?
where and what do i have to change please?
-
what do you have to do to show a image(different for each categorie)in place of that folder icon?
To install this MOD :
http://www.4homepages.de/forum/index.php?topic=6922.0
-
Hi at all!
I have some categories which don't have pictures itself, but they have under-categories with pictures.
I have installes this mod, but near this categories there is no pictrure displayed :-(
Is there a possibility to show an random-picture of one off their under-categories?
Greetings Nika-2000
-
Is there a possibility to show an random-picture of one off their under-categories?
I might be wrong but I don't think this functionnality has ever been published yet.
-
I know this has been asked before and I'm still waiting for any answer that's why I watch all topics that fits to this question.
Would be great if someone know how to make it!
-
I thought about that for a while and I MIGHT have an idea to get this working, but this is a workaround. An working 4images-setup is running at http://galerie.cvjmbonn.de
The idea is to use a switch, which turns the display of the thumbs in an category off, imagine you have the following setup
1. Cars
1.1 old cars
1.2 new cars
Cars has no pictures but you want to have a random thumb from old and new next to cars catogy info.
1. step: you DO include a set of pictures in cars, from which these thumbs are generated
2. step: you switch the thumbs-display in cars OFF (which leaves you with an empty category again)
The first step is quite simple, you upload images as links to the real images, choose the thumbnail in both, img and thumbnail, no space used for that.
Second step needs adjustment of template categories.html, you put the following "brace" around the stuff that should be ignored if the switch is set
<?php $pos = strpos ("{cat_description}", "class='hc'"); if ($pos === false) { ?>
{paging_stats}
...
{if thumbnails}
...
{endif thumbnails}
...
{paging}
...
{category_dropdown_form}</td>
...
<?php } ?>
YOU descide by this, which parts should be ignored, i skip stats, thumbs, paging and the dropdown list
Now you have to activate the switch, just add <span class='hc'></span> to the description of the category you want to clear, and you are done (hopefully you do not have an hc-css-class, if so, you have to choose another name for the switch)
Yours
John
-
If you intend to use PHP commands under your HTML template files, make sure to enable the PHP_CODE initial under your includes/constants.php file. ;)
Note: It is not the safest method but it could work anyway.
-
Jises.
Can I just pay someone to do this for me?
Anyone?
-
Ah it's working !
Many hugs to you John !!!
The only thing I don't like is that it is still counting them in {num_images} but I don't mind
-
Jises.
Can I just pay someone to do this for me?
Anyone?
I guess if you cant even do the simple code change from these modification, then yes, you'd better pay someone do it for you...
-
That's a very simple mod that works well for me except for one thing. I have both horizontally and vertically oriented images in my categories. Is there a way that I can get the random images both resized and correctly proportioned rather than being stretched or squeezed in one direction. Thanks
-
Hi!
{if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" width="45" height="30" border="0"></a>{endif random_cat_image_file}
What must enter here : {cat_url} that the image open. (details.php?image_id=3269)
-
Sorry, I didnt understand your question...
-
:(
When I use the sript, the image link represents the category.
So that may settle, so that image represents the image's space, as the random image.
-
I would like If the category I open image, that image and may not be the category opened.
-
what
-
The last "question" was almost 8 months ago....but, yes - WHAT?
-
Hi V@no,
in my categories bit i have
{ifno random_cat_image_file}<img src="{template_url}/images/folder.gif" width="20" height="13" alt="" />{endifno random_cat_image_file}
{if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" border="1"></a>{endif random_cat_image_file}
In my root i have my main categories which have subcategories and there are pictures in these main categories. in my subcategories and their subcategories, the random category image is working perfectly - but in my root (main page) i get the standard folder icon as well as en empty image icon where a category image is trying to load.
any ideas?
Kind Regards,
WeZ
-
If you have no images in the categories shown on home page, then it explains everything...
-
i know it's late on my side of the planet, but i beleive my sentence does state that i DO have images in these main categories :wink:
-
Oh, right...sorry...
I just checked on a fresh v1.7.3 and it worked just fine...though, I had to manualy activate the SHOW_RANDOM_CAT_IMAGE in includes/constants.php
So, if its activated (including the SHOW_RANDOM_IMAGE) then I dont know what could be wrong...perhaps other modifications you've made?
-
Hi V@no,
thats always a possibility. Can i submit the php of my files for you to view? if so, which files are pertinent to this function?
Kind Regards,
WeZ
-
Hello.
I'd like to ask, how can I resize the picture in random image window? It's just a little too big for random image window and it deforms all the template. Thanks in advance.
-
First of all, thank you for this random thumbnail add-on!
I am trying to replace the random thumbnail with a static thumbnail, so that there is always just one designated thumbnail per category.
My code is as follows:
<td valign="top">
{if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" border="0"></a>{endif random_cat_image_file}
</td>
<tr bgcolor="#dddddd">
<td height="25"> <a href="{cat_url}" class="maincat">{cat_name}</a> ({num_images})
{if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new} </td>
</tr>
I am struggling to replace this with a particular thumbnail for each category without destroying how categories are created and linked to the control panel. 8O
Has anyone done this or do you have any suggestions?
-
Hi,
i have the same problem with a fresh 1.7.4.
In the subcats i see the random image, in the main not :(
see this -> main cat -> http://www.terraristik-galerie.de/neuegalerie/index.php
and this -> sub cat -> http://www.terraristik-galerie.de/neuegalerie/categories.php?cat_id=6
What is the error???
on 1.7 i have not this problem...
-
No one an idea?
I have seen that the image URL ist not an URL to an image. its the url to the index.php
-
Also bei meiner 1.7.4 läuft es ohne Probleme...
Habe nur das Template geändert und dann noch in der constants.php den Wert von 0 auf 1 gestellt und zack war alles wie gewünscht vorhanden...
Musst also was vergessen haben oder was weiss ich, sicher das Du noch keine Mods eingebaut hast? (o:
-
Also ich habe auch nur die category_bit.html und die constants.php geändert. Mehr habe ich bei der frischen installation noch nicht gemacht.
Das einzige was ich habe ist die alte Datenbank. Aber das ganze hat ja nichts mit der Datenbank zu tun. Sehr merkwürdig, vor allem weil es bei der 1.7 er Version funktioniert hat.
-
Na dann installiere mal eine frische 1.7.4, dann wirst du sehen das es dort auch geht... (o:
Und das kann natürlich auch an der Datenbank liegen!
Weil wenn man Daten mit der Wildcard * abfragt bekommt man die Daten ungefährt so zurück "bl, bla, blabla, blablabla" ist blabla jetzt ein von dir hinzugefügtes Feld gibt es Probleme weil das Script eigentlich an der Stelle blablabla erwartet, verstehste?
-
Ok, I know I used to have a mod working to show random cat image instead of thumbnail even when there was no image in the category (only fro the subcategory) as some others have asked for.
I have sine upgraded to 1.74 and have searched the forum... I am guessing the thread was lost with the cmoplete forum durring that terrible hack....
If this thread exists where ut us possible to do this can someone post a link to it for me?
If not help me with a direct clue about how to show random pics from sub-categories as category image....
Thanks-
Robert
-
why am i getting this:
An unexpected error occured. Please try again later.
ERROR: Could not load configuration settings!
-
SETTINGS_TABLE alter. Restore backup.
-
Hi!
On my cats I have 2 main cats (testing 4images...) the fist one has images, the other one has subcategories but no pics
+ Gallery
+-- Main Cat 1
| +-- Pictures
+-- Main Cat 2 (not pics here)
+-- Sub cat 1 (pics)
+-- Sub cat 2 (pics)
So, the main cat 1 has a random pic instead the folder icon, but the main cat 2 has nothing (I think this is normal), AND the sub cat 1 (which has pics inside) has NO random icon!
(http://img504.imageshack.us/img504/3263/catsha6.th.jpg) (http://img504.imageshack.us/my.php?image=catsha6.jpg)
this is the main cat
(http://img504.imageshack.us/img504/2376/subcatscy9.th.jpg) (http://img504.imageshack.us/my.php?image=subcatscy9.jpg)
and this is the sub cats
Any idea on the subject? ;)
-
Hi Matosale,
i think i know what's up with your problem... the Category "Spain" has 14 images in it (NOT including the ones in sub cats). It displays Category Image fine... Although "Austria" has 1776 pictures in it, they are all in sub cats - this leaves the MOD no pictures in the "Austria" folder to generate a picture from.
move a few pictures into the root of your Austria folder and you should see an icon for it from homepage...
Cheers
WeZ
-
where about can I edit the html in what exactly do I put to have a thumnail of about 50x50?
-
edit.
-
Great mod. It works as expected.
-
Hi there!
Just tried to get this working, but with no success... 8O
Have 4images 1.7.6 with photo-community template.
Any Hints?
------------
Mahlzeit!
Hab gerade versucht das hier zum laufen zu kriegen, aber ohne Erfolg.
Irgendwelche Ideen woran das liegen kann?
LG Dany
-
<div class="cat"><a href="{cat_url}">{cat_name}</a><span>({num_images})</span>{if cat_is_new} <span class="new">{lang_new}</span>{endif cat_is_new}</div>
{if cat_description}<span class="smalltext">{cat_description}</span><br />{endif cat_description}
{if sub_cats}{sub_cats}{endif sub_cats}
i have this code in iceberg template catogry_bit...the above is the whole code..
how to set the custome image for catogries..???
please help...looking forward to your help..
-
..
how to set the custome image for catogries..???
...
not custom, but random
<div class="cat"><a href="{cat_url}"><img src="{random_cat_image_file}" border="0"></a><span>({num_images})</span>{if cat_is_new} <span class="new">{lang_new}</span>{endif cat_is_new}</div>
{if cat_description}<span class="smalltext">{cat_description}</span><br />{endif cat_description}
{if sub_cats}{sub_cats}{endif sub_cats}
-
...
thanks..i found a mod here on this site which give us capability of set custom image..
Anyways thanks..
-
Thanks. It helps me alot :lol:
-
thanks
-
Thank you for the helpful content
Good luck :D
-
can you resize the thumbnails as you want?