Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2005-07-18 17:06:44

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

yep,
but the plugin still does not return anything:(


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#26 2005-07-18 22:20:48

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

That seems odd. Does your tag look something like:-
<code><txp:dru_random_image category=“mine” /></code>
<br />
Or have you looked at this instead?

Last edited by thebombsite (2005-07-18 22:25:18)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#27 2005-12-25 19:46:32

_astyonax_
New Member
From: somewhere in Italy
Registered: 2005-12-25
Posts: 4

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

Hi, I tried this plug-in and I found it very interesting, but there are some thing I changed:

possibility to define a table prefix

output a thumbnail of the image. Actually my aim was a switch between thumbnail and full size image, but I’m new to php.

I found some problems with Clean URLs so I fixed the problem

AND, the more important it follow and respect subcategories.

here is the code,
[code] function dru_random_image($atts) { global $path_from_root, $img_dir, $siteurl; $path_from_root=substr($path_from_root,1); $category = ‘%’;

if (is_array($atts)) extract($atts); $pref= (!empty($pref)) ? $pref : “it_”; // define here your default table prefix (with trailing ) remove it, please $rec_query=“SELECT * FROM “.$pref.“txp_category WHERE type=\“image\” AND parent=\”$category\”“; $rec_res=getRows($rec_query,$debug); if($rec_res){ foreach($rec_res as $cat){ extract($cat); $rec_cat=$rec_cat. “ OR category = \”$name\”“; } } $rs = getRow(“SELECT id, ext,alt,caption FROM “.$pref.“txp_image WHERE category = \”$category\” $rec_cat ORDER BY rand() LIMIT 1 “); if($rs) { extract($rs); if (!empty($label)) $label=$label.’<br />’; return $label.’<img src=“http://’.$siteurl.’/’.$img_dir.’/’.$id.‘t’.$ext.’” alt=”’.$alt.’” title=”’.$caption.’” />’; } return image($rs); return ‘<txp:notice message=“malformed random_img tag” />’; }

[/code]
bye bye

Last edited by _astyonax_ (2005-12-25 19:53:12)

Offline

#28 2006-03-23 18:22:58

Quasi
Member
From: Mieres, Asturias (ES)
Registered: 2006-03-16
Posts: 15
Website

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

Hello! From Spain :).
As I can change width and height property?
Thanks

Offline

#29 2006-09-17 21:48:39

lukepermsn
Member
From: london
Registered: 2004-07-15
Posts: 57
Website

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

yes, the ability to have the tag output a random image from all child categories of a parent would be very very useful!


“Absorb what is useful, Discard what is not, Add what is uniquely your own” – Bruce Lee

Offline

#30 2006-11-27 15:04:30

hachi
Member
From: switzerland
Registered: 2004-04-24
Posts: 25

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

Has anyone tried this with the newest release 4.0.4. Does it work or is there an alternative?
Thanks Oliver

Last edited by hachi (2006-11-27 15:05:00)

Offline

#31 2007-10-22 17:01:40

accarter
Member
From: Los Angeles
Registered: 2007-08-31
Posts: 31
Website

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

Is there a way to specify the alignment with this plugin? Thanks!

Offline

#32 2007-10-23 03:41:59

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

accarter wrote:

Is there a way to specify the alignment with this plugin? Thanks!

CSS styling have nothing to do with the plugin, so yes you can specify alignment.

Cheers!

Offline

#33 2008-08-13 08:36:49

fangonk
Member
Registered: 2007-07-12
Posts: 44

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

I edited this plugin to display thumbs instead of full images but can anyone think of a way to link those thumbs to their full-size versions? I really want to avoid a situation where I have to individually link images to articles.

Offline

#34 2008-08-13 09:27:57

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

Re: [plugin] [ORPHAN] dru_random_image: Random image from image category

fangonk wrote:

a way to link those thumbs to their full-size versions? I really want to avoid a situation where I have to individually link images to articles.

Not sure what you mean by “individualy link images to articles”. Instead of using the Article Image field, Are you intending to just show a random image against each article and have it clickable? Two ways I can think of to do this (both involve my plugins, sorry) :

  1. smd_random_banner — which grew out of this plugin — can display thumbs with thumb="1". You can also link the thumb to anywhere you like but the destination needs to be put into one of the image attributes (name, alt, or caption) so might be a little messy
  2. smd_gallery can choose a single image from a category (using limit="1") and can be made to choose a random image by using sort="random". Again, you can display the thumbnail and have it automatically link to the full size either as a regular link, or as a popup, as a lightbox, a zoom, or anything you want

Do any of those meet your needs? I’m not sure this plugin can be used to link to images without some big mods.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB